How to customize the text in an embedded post?

Thanks for explaining Kevin. There are no settings specifically directed at this issue, but there’s two ways you could approach this.

Customize what HTML is pulled from your site

The way embeds work is that they scrape the content from a site using the Readability gem. The gem and it’s output use the following options to filter what HTML is scraped

opts[:whitelist] = SiteSetting.allowed_embed_selectors if SiteSetting.allowed_embed_selectors.present?
opts[:blacklist] = SiteSetting.blocked_embed_selectors if SiteSetting.blocked_embed_selectors.present?
allowed_embed_classnames = SiteSetting.allowed_embed_classnames if SiteSetting.allowed_embed_classnames.present?

So you could set the site settings allowed_embed_selectors, blocked_embed_selectors, or allowed_embed_classnames to restrict which content is pulled from your HTML and shown in the Discourse post, e.g. you could restrict it to non-existent classes so no content was pulled.

The content scraped from the site then has this HTML appended to it:

"\n<hr>\n<small>#{I18n.t('embed.imported_from', link: "<a href='#{url}'>#{url}</a>")}</small>\n"

So you’d just need to customize the embed.imported_from text in the admin panel to tell the user to read the content on the blog. Note that you can interpolate the link to the content in that text, e.g. the english version of the locale text is

This is a companion discussion topic for the original entry at %{link}

Hide the Show Full Post button

As you suggested, hiding the show full post button with CSS should also work.

2 Likes