Osclass Support Forums

Osclass theme support => Delta Osclass Theme => Topic started by: morfik on February 26, 2023, 11:14:50 AM

Title: GOOGLE RICH SNIPPETS incomplete code
Post by: morfik on February 26, 2023, 11:14:50 AM
Google reports the following warnings:

Either "offers", "review", or "aggregateRating" should be specified. But the microdata for the site is generated by Osclass:


Code: [Select]
{
  "@context": "https://schema.org/",
  "@type": "Product",
  "name": "some name",
  "image": "https://website/0.",
  "description": "some description...",
  "brand": "Osclass",
    "offers": {
    "@type": "Offer",
    "itemOffered": "Name",
    "url": "https://website/some-location",
        "price": "0",
    "priceValidUntil": "2024-02-26",
    "availability": "https://schema.org/InStock"
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "5",
    "bestRating": "5",
    "worstRating": "0",
    "ratingCount": "1",
    "reviewCount": "1"
  }
 }

Looking through the Delta theme files, I noticed that there's the following code there (in themes/delta/item.php):

Code: [Select]
    <!-- GOOGLE RICH SNIPPETS --> 
  <span itemscope itemtype="http://schema.org/Product">
    <meta itemprop="name" content="<?php echo osc_esc_html(osc_item_title()); ?>" />
    <meta itemprop="description" content="<?php echo osc_esc_html(osc_highlight(osc_item_description(), 50
0
)); ?>
" />
    <?php if(osc_count_item_resources() > 0) { ?><meta itemprop="image" content="<?php echo $resource_url;
 
?>
" /><?php ?>
  </span>

There's no "offers", "review", or "aggregateRating" specified. . I think this code should be removed or some entries added to it, to fix the google warning.

Also it looks like there are two microdata blocks -- one generated by Osclass, and the other generated by the theme. Should it be in this way?
 
Title: Re: GOOGLE RICH SNIPPETS incomplete code
Post by: MB Themes on February 26, 2023, 12:40:10 PM
You csn remove this code if you decide that osclass generates structured data.
Title: Re: GOOGLE RICH SNIPPETS incomplete code
Post by: morfik on February 26, 2023, 12:49:25 PM
OK, I removed it, and it looks like google doesn't complain about it anymore.
Title: Re: GOOGLE RICH SNIPPETS incomplete code
Post by: MB Themes on March 04, 2023, 09:30:53 AM
Nice, good job  :)