Embeds stripped when "show full post..." button is clicked


#1

For example, I inserted a Youtube video inline in a WP post that got pushed to Discourse as a topic. When people click the “Show full post…” button, for some reason the Youtube video doesn’t come through. (I’m only guessing this is true for all embeds. Perhaps it’s a Youtube-specific problem?)


(Jeff Atwood) #2

It uses the readability algorithm to find the core content on the page. This isn’t an exact science.


#3

I’m not familiar with the readability algorithm, but is it like a “Reader” mode from Safari or something?

It still seems strange to me that YouTube videos in the middle of the content go missing. Would that be a “sometimes” thing or are videos just excluded? And if videos are excluded, are pictures?

Sorry I’m not real familiar with the feature yet. Just trying to figure out what to expect.


(Simon Cossar) #4

When the Show Full Post button is clicked, Discourse scrapes the page that the post was published from and attempts to find the most readable content on the page. Youtube links are consistently stripped from the post.

I did some tests with this today to see what happens with images. What I’m finding is that whether or not an image is displayed depends on the image’s markup. If I publish a post from WordPress with the new Block Editor, images are not displayed when I click the Show Full Post button. If I publish a post with the Classic Editor - just using a regular img tag, images are displayed. The difference seems to be the extra markup that is added by the Block Editor.


#5

Thanks!

Follow up question: Is it possible to just have the featured link and onebox it at the time of topic creation via WP?


(Simon Cossar) #6

Yes, have a look at the Publish Post as Onebox section of this topic: WP Discourse template customization.