Blogger posts have no snippet

סיכום מבוסס בינה מלאכותית

In this Support thread titled “Blogger posts have no snippet,” joao_pimentel_ferrei asks why Blogger posts don’t generate rich snippets in Discourse, unlike WordPress. Falco explains that Discourse relies on OpenGraph meta tags (like og:title, og:description, etc.) and recommends testing with Iframely. joao_pimentel_ferrei confirms trying to add OpenGraph tags via Blogger’s template but notes that Discourse still doesn’t render snippets, even though Iframely fetches them correctly. Eventually, joao_pimentel_ferrei shares a working solution: inserting OpenGraph tags before </head> in the Blogger template, including dynamic values like data:blog.pageName and data:blog.canonicalUrl, and adding og:description after <data:post.body/> using data:post.snippet or a custom snippet function. A test post confirms success. In a final note, joao_pimentel_ferrei asks why favicons aren’t appearing despite being enabled, linking to a site as an example.

Any reason why the blogger posts do not generate a snippet?

For example, on this blogger post, I paste a URL, and merely the URL appears:

But on Wordpress, normally, a snippet appears.

Which meta-info or HTML tags Discourse gets to generate a snippet?
Which information shall one have in a blogger post, such that a sinipet is generated?

thank you

For testing we recommend using Iframely.

A typical blog post will have OpenGraph tags in the head seaction, like:

<meta property="og:site_name" content="Discourse Blog">
<meta property="og:url" content="https://blog.discourse.org/2018/05/discourse-2-0-released/">
<meta property="og:title" content="Discourse 2.0 released!">
<meta property="og:description" content="We released Discourse 2.0 on May 31st, building on Discourse 1.9 from January. New Admin Dashboard We’ve completely redesigned the admin dashboard to show off your most relevant and essential community health metrics right at the top, as well as trending searches. Shared Drafts Staff can designate a category for shared drafts, and pre-compose topics that only other staff can see for review prior to posting. After posting, all logged edits are removed so the history is clean, and the timestamp is reset, too. Reply mode toggle While composing a […]">

Thanks a lot. Apologies to ask again after this time, but I’ve been around trying to insert that on my blogger blog template

Does it take time to fetch/update?

The tester you suggested seems to fetch the code correctly but here the discourse still does not render the snippet.

Thanks, finally I solved everything.

For blogger, I used this code, which I inserted right before the tag </head> in the blogger’s template

    <!-- OpenGraph starts-->
    <meta content='article' property='og:type'/>
    <meta expr:content='data:blog.title' property='og:site_name'/>
    
	<!-- Title and URL -->
    <meta expr:content='data:blog.pageName' property='og:title'/>
    <meta expr:content='data:blog.canonicalUrl.https' property='og:url'/>
		
    <!-- Image -->
	<b:if cond='data:blog.postImageThumbnailUrl'>
		<meta expr:content='data:blog.postImageThumbnailUrl' property='og:image'/>
    <b:elseif cond='data:blog.postImageUrl'/>
    	<meta expr:content='data:blog.postImageUrl' property='og:image'/>    
	<b:else/>
    	<meta content='YOUR_LOGO_URL' property='og:image'/> 
    </b:if>

	<meta expr:content='&quot;pt_PT&quot;' property='og:locale'/>

    <!-- OpenGraph ends-->

The og:description is not fetched inside <head> since the variable data:post is not available in <head>. You must add in the template right after the line <data:post.body/> the following line:

<meta expr:content='data:post.snippet' property='og:description'/>

If you want a costumized snippet you may use this instead

<meta expr:content='snippet(data:post.body, { length: 150, links: false, linebreaks: false })' property='og:description'/>

now it seems to work smoothly, here’s a test :slight_smile: (please, it’s not spam, it’s merely a test showing that it does work here in discourse)

and btw, why there’s no favicon when all the favicons are enabled?