JSON-LD data

Discussion in 'Search Engine Optimization' started by suncho261, May 23, 2016.

  1. suncho261

    suncho261 New Member

    Hello guys,

    I want to share my little experience. At each site construction I follow the rules of search engines - minimized code, placing the ALT tags, relevant meta description, etc.

    I notice that a search in Google weight has structural markup. They recommend using JSON-LD format and I am doing something quite simple - in index.tpl file for Blog or Nevs plugin I add the following code.

    Code (Text):

    {literal}
            <script type="application/ld+json">
            {
              "@context": "http://schema.org/",
              "@type": "BlogPosting",
              "url": "{/literal}{$smarty.const.IA_SELF}{literal}",
              "datePublished": "{/literal}{$blog_entry.date_added|date_format:'c'}{literal}",
              "dateModified": "{/literal}{$blog_entry.date_added|date_format:'c'}{literal}",
              "articleSection": "news",
              "aggregateRating": {
                "@type": "AggregateRating",
                "bestRating": "5",
                "ratingCount": "{/literal}{$blog_entry.views}{literal}",
                "ratingValue": "5"
              },
              "image": {
                "@type": "ImageObject",
                "url": "{/literal}http:{printImage imgfile=$blog_entry.image fullimage=true url=true}{literal}",
                "height": 400,
                "width": 800
              },
              "publisher": {
                "@type": "Organization",
                "name": "Where you can put site name or something else",
                "logo": {
                  "@type": "ImageObject",
                  "url": "{/literal}{$smarty.const.IA_URL}uploads/site_logo.png{literal}",
                  "width": 600,
                  "height": 60
                }
              },
              "wordcount": "{/literal}{$blog_entry.body|count_words}{literal}",
              "articleBody": "{/literal}{$blog_entry.body|strip_tags|truncate:$core.config.blog_max:'...'}{literal}",
              "creator": "{/literal}{$blog_entry.fullname}{literal}",
              "headline": "{/literal}{$core.page.title}{literal}",
              "name": "{/literal}{$core.page.title}{literal}",
              "mainEntityOfPage": "True",
              "author": {
                "@type": "Person",
                "name": "{/literal}{$blog_entry.fullname}{literal}"
                }
              }
            </script>
        {/literal}
     
    For now Blog and News plugin not have rating function, but you can add one more column in database table - "views" and increase it in every article view. Then you can use this for number of votes.

    Or if you want to give an option to visitors to rate your articles, you can spend 1 hour and extend the plugin with following these steps:
    1. Add one more table with columns - article_id, rating, user_ip, time (if you want to know when)
    2. Create a stars with jQuery or use this - http://antenna.io/demo/jquery-bar-rating/examples/
    3. Write a simple AJAX function to can users rate your article one time (detect by user IP address)
    4. Make a little calculation for article votes and rate.
    5. Assign your calculation and show it in article view TPL file.

    Important: The first way is not recommended because it can be detected by Google and you can be removed from the results.

    Note: The rating it's not most important thing, I optimize pages for persons, hotels, events, products and again have good results.

    With structural markup I reach 1-4 position in Google for some words. It is not guaranteed that by structural markup will reach the first position, but it is guaranteed that you will have a better position in search.
    Dayir_A. and Gleb_S. like this.

Share This Page