[Support request] Schema markup of star rating

Home Forums Support [Support request] Schema markup of star rating

Home Forums Support Schema markup of star rating

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #760514
    Nacho

    Hello,

    I´m having issues with the star rating widget since in the schema markup test it shows errors and google is not recognizing the rating as you can see in this test: https://search.google.com/structured-data/testing-tool?hl=es#

    The site I´ve tested is my own homepage but nothing. It seems to be working with the basic themes as twenty fifteen and with the elementor canvas for example but with GP it does not.

    Can you help me with this?

    Thanks a lot.

    Bests,

    -Nacho.

    #760714
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This is because Elementor is setting the ratings microdata for the stars, but it’s not setting a type to the actual container.

    By default, GP uses CreativeWork as the content type. We can change it to Product with a filter, but it might be better to apply that type to the individual containers that actually hold the ratings, as the entire page doesn’t seem to be a product.

    Let me know 🙂

    #760859
    Nacho

    Hello Tom,

    Understood, well kind of.

    How do I change the content type of GP to a services page with ratings and how do I change the individual container?

    Thanks a lot for your help.

    #761404
    Tom
    Lead Developer
    Lead Developer

    For the GP container, you can do this:

    add_filter( 'generate_article_itemtype', function( $type ) {
        return 'Product';
    } );

    However, that assumes the page is geared towards a product.

    I’m not sure about the specific Elementor container – that may be something they need to answer.

    #761787
    Nacho

    Hello Tom,

    But that filter will work in every page right? What if I just want to do that just for a particular page?

    Also, it sets the page as a product or just the container?

    I´ve sent a message to the Elementor team and I´m waiting for them to answer. I´ll let you know.

    Last one, How can I set the padding for the content in the container just for a particular page?

    Thanks a lot for your help Tom.

    #762244
    Tom
    Lead Developer
    Lead Developer

    That code does every page on the site.

    You can target a specific page like this:

    add_filter( 'generate_article_itemtype', function( $type ) {
        if ( is_page( 10 ) ) {
            return 'Product';
        }
    
        return $type;
    } );

    You just need to adjust the 10 to the page ID you’re targeting.

    This changes the schema type of the content container provided by the theme.

    For the padding, try this:

    .page-id-10.separate-containers .inside-article,
    .page-id-10.one-container .site-content {
        padding: 50px;
    }

    Again, make sure to update the 10 to the actual page ID.

    #762256
    Nacho

    Hello Tom,

    The filtering thing does not work well. I´ve updated the URL in this topic and tested in Google Schema and it shows more errors than before.

    I´ve tried the padding and worked perfect.

    Is this schema thing fixable?

    Thanks a lot.

    #762612
    Tom
    Lead Developer
    Lead Developer

    The filter worked, but it seems the type of review rating you’re using isn’t compatible with the Product type. The other errors are recommended items that should be present when using Product.

    You could try using Review instead of Product as your type.

    #763093
    Nacho

    Hello Tom,

    I´ve just tried but nope same errors.

    I´ve been searching in the forum but I don´t see anything.

    Any idea?

    Thanks a lot.

    #763108
    Tom
    Lead Developer
    Lead Developer

    Another option is to disable the GP schema on that page:

    add_filter( 'generate_schema_type', function( $type ) {
        if ( is_page( 10 ) ) {
            return false;
        }
    
        return $type;
    } );
    #763124
    Nacho

    Hello Tom,

    I´ve just tried and it does not work either.

    Is there another info I can give to solve this?

    Thanks a lot.

    #763133
    Tom
    Lead Developer
    Lead Developer

    The only thing we can do is remove the schema to prevent errors. Elementor itself would need to give the box containing the reviews the proper schema type.

    Another method to disable the GP schema on that page is this:

    add_filter( 'generate_article_microdata',function( $data ) {
        if ( is_page( 10 ) ) {
            return false;
        }
    
        return $data;
    } );

    Again, 10 needs to be changed to the ID of that specific page.

    It likely won’t fix all of the errors, as the review schema needs a proper schema type attached to its container.

    #763136
    Nacho

    Hello Tom,

    Oh yes I´m changing the ID all the time to mine.

    I´ve just tried that but nothing, loads of errors and the important one that Schema rating is not recognized.

    Do you recommend inserting an schema plugin there instead the elementor one?

    Thanks Tom.

    #763368
    Tom
    Lead Developer
    Lead Developer

    Is that last function still active? It seems the container is still set to Product.

    A JSON-LD plugin might help 🙂

    #764556
    Nacho

    Hello Tom,

    Yes, the last function is still active.

    Why? Did you find something to work on this?

    About the JSON-LD, I thought I saw in your blog that you were releasing this later?

    Thanks a lot Tom.

Viewing 15 posts - 1 through 15 (of 20 total)
  • You must be logged in to reply to this topic.