Onebox doesn't work for WordPress

AI-generated summary

The discussion revolves around the inability of Discourse’s onebox feature to work with WordPress URLs using the ?p=793 format. BCHK asks how to enable oneboxing for these URLs. zogstrip suggests implementing OpenGraph or oEmbed. mpalmer notes that the WordPress page lacks required OpenGraph tags, particularly og:type and og:url, which are necessary for oneboxing. pfaffman explains that Discourse may not parse URLs with query parameters like ?p=xxx, and recommends enabling WordPress permalinks to resolve the issue. simon confirms that oneboxing works with the post-number format and suggests using the Yoast SEO plugin to add proper OpenGraph tags, providing an example of its effectiveness.

Hi Guys,

I still have a problem with another plugin/gem. My main website is based on wordpress - but a long time ago I set up the posts to have the URL format like this:

http://schizophrenia.com/?p=793

Is there anyway that I can get my discourse forum to onebox these URLs?

Thanks,

Brian

https://github.com/discourse/onebox

You need to properly implement either OpenGraph or oEmbed.

Are you saying the Wordpress only implements opengraph or oEmbed with one form of URL? It works fine with URLs that include the title name, but not the URL format I have - why would that be?

Do you have an example URL that does embed properly, preferably a working version of that same page, for comparison? It looks like Wordpress is trying to use OpenGraph, but the OG spec says:

The four required properties for every page are: og:title […] og:type […] og:image […] og:url

The only one that page is displaying for me is og:image, which is why we’re not oneboxing that URL properly. If Wordpress is presenting all the OG meta tags on one version of the page, but not on another, that would be… weird, but something you’d have to take up with Wordpress.

I am not a WordPress expert.

Because either oEmbed or Discourse won’t read past the ?.

I’m pretty sure that if you turn on any permalinks other than “plain” your problem will be solved. It won’t hurt anything because the old ?p=xxx links will continue to work (but remember I’m not an expert, so you should check this after you turn on permalinks).

See http://schizophrenia.com/wp-admin/options-permalink.php

Here’s one from my site:

https://www.literatecomputing.com/product/wordpress-discourse-together/

WordPress oneboxes will work using the plain (post number) permalink structure. I think the issue you’re having is the lack of OpenGraph tags on the page. An easy way to get OpenGraph tags on your site is to install the Yoast SEO plugin. Here’s an example that uses the post-number permalink structure - first with the Yoast SEO plugin enabled, and then a similar post, but with Yoast SEO disabled.