For displaying JSON-LD data for Google SERPS,
https://developers.google.com/search/do ... es/article
I added following coding to the detail template of the CGBlog module:
Code: Select all
{strip}
<__script__ type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "{$entry->canonical}"
},
"headline": "{$entry->title|escape}",
"image": [
{if $entry->fieldsbyname.image->type=='image'}
{foreach from=$entry->fields item='field'}
{if $field->type == 'image'}
"{$entry->file_location}/{$field->value}"
{if not $field@last}, {/if}
{/if}
{/foreach}
{else}
"https://www.example.com/altrernative_image.png"
{/if}
],
"datePublished": "{$entry->postdate}",
"dateModified": "{$entry->modified_date}",
"author": {
"@type": "Person",
"name": "{$entry->author}"
},
"publisher": {
"@type": "Organization",
"name": "{$entry->author}",
"logo": {
"@type": "imageObject",
"url": "https://www.example.com/logo.png"
}
}
}
</__script>
{/strip}
Have fun