• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Tutorial: CGBlog + JSON-LD Markup
PostPosted: Wed Mar 13, 2019 9:49 am 
Offline
Forum Members
Forum Members

Joined: Fri Nov 10, 2017 10:25 am
Posts: 10
Just a quick hack:

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:
{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}

Use <__script__ ... > without underline, unlike above!

Have fun :)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Tutorial: CGBlog + JSON-LD Markup
PostPosted: Thu Mar 14, 2019 9:33 am 
Offline
New Member
New Member

Joined: Thu Mar 14, 2019 9:23 am
Posts: 1
Thanks for this tutorial. I work with data JSON-LD now.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting