FAQ Schema structured data

#29296
Viewing 14 replies - 1 through 14 (of 14 total)
  • Hello,

    Thank you for contacting Rank Math today.

    This is not yet available in the plugin but it is on the to do list for the upcoming updates.

    At the moment, I can recommend that you use the following online tool to generate the necessary schema and then add it to the header file of your site: https://saijogeorge.com/json-ld-schema-generator/faq/?utm_campaign=Rank+Math

    You can use the headers and footers plugin for this.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Pete
    Rank Math free

    Ok but headers and footers plugin pus code on all pages, not one specific page which would be needed.

    So when will rankmath do this, it is crucial. Please don’t say I need to go back to Yoast!

    Todd
    Rank Math free

    Hi Pete,

    That page provides all the code you need for adding FAQ schema to your pages.

    With Rank Math, you can expect it very soon but I do not have an ETA I can share. Sorry.

    Pete
    Rank Math free

    That page provides all the code you need for adding FAQ schema to your pages.

    The page is not totally clear. I understand I need to add it to the head (but need to find a way to do that on just one specific page)

    But what do I put in the actual page itself? Do I just need to (somewhere on the page) have the same questions and answers as I put in the header code?

    Thanks

    Hi Pete,

    Thanks for the follow up.

    You need to add the actual questions and answer on your FAQ page on the online generator described above and then inject the code to header of the FAQ page.

    Since the header and footers plugin only gives the option of all pages or the homepage here is a workaround that you can use by using the following filter on your theme’s functions.php file:

    /* A snippet to inject FAQ schema on FAQ page */
    add_action('wp_head', 'my_faq_schema');
    function my_faq_schema(){
    if(is_page('faq_page_id')):
    ?>
    <script type="application/ld+json">{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Question one","acceptedAnswer":{"@type":"Answer","text":"Answer one"}},{"@type":"Question","name":"Question Two","acceptedAnswer":{"@type":"Answer","text":"Answer Two"}}]}</script><!--FAQPage Code Generated by https://saijogeorge.com/json-ld-schema-generator/faq/-->
    <?php
    endif;
    };

    I hope this info helps. Thank you.

    Pete
    Rank Math free

    Thanks for the workaround

    But I am still not clear on the generated code

    Do I put it both in the head and on the page, of just in the head but then what do I put on the page?

    Todd
    Rank Math free

    Hi Pete,

    You have to put that code in your theme’s functions.php file

    Replace faq_page_id with the FAQ page’s ID. You can find the page’s ID using this tutorial:
    https://mythemeshop.com/blog/how-to-find-post-category-tag-comments-or-user-id-in-wordpress/

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Pete
    Rank Math free

    Sorry I didn’t mean the function.php code I know about how to find the page id

    What I meant was the code generated by

    https://saijogeorge.com/json-ld-schema-generator/faq/?utm_campaign=Rank+Math

    I have put that code in the head as instructed

    I have put the functions.php code in functions.php and edited the correct page id

    But then nothing shows on that page.

    Do I add anything to the actual page???

    so do I also put it on the page or what goes on the page to show the FAQs on the site?

    • This reply was modified 4 years, 10 months ago by Pete.
    • This reply was modified 4 years, 10 months ago by Pete.
    • This reply was modified 4 years, 10 months ago by Pete.
    Todd
    Rank Math free

    Hi Pete,

    If you are just using this to generate FAQ code:
    https://saijogeorge.com/json-ld-schema-generator/faq/?utm_campaign=Rank+Math

    Then, you have to paste the resulting code inside your post/page as HTML code.

    You do not need to add anything to your functions.php file.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Pete
    Rank Math free

    Then, you have to paste the resulting code inside your post/page as HTML code.

    You do not need to add anything to your functions.php file.

    Thanks but then it just shows a blank page also.

    Todd
    Rank Math free

    Hi Pete,

    Yes, of course, it would.

    That code only adds the Schema of the FAQs so the bots can see the structured data. You have to add the actual FAQs for visitors separately in a regular text format.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Pete
    Rank Math free

    Thank you I will try that.

    Do the questions and answer have to be exactly the same

    For example (1) if I edit an answer even very slightly, do I then have to redo the generated code all over again?

    (2) My QAs are all within a spoiler shortcode:

    [spoiler title ="Metal Mouthpieces are brighter than hard rubber" style="orange"]
    
    The thing that makes a mouthpiece bright is the baffle or chamber size, not the material.
    
    [/spoiler]

    Do I extract just the question text and just the answer text in this case? Thanks

    • This reply was modified 4 years, 10 months ago by Pete.
    Todd
    Rank Math free

    Hi Pete,

    1. It is not necessary but we recommend doing that so that the users and the bots see the same thing.

    2. Yes, you should only use text. You can use HTML as well but using shortcodes in the FAQ is a no-no.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Pete
    Rank Math free

    Thanks that’s great.

    You can use HTML as well but using shortcodes in the FAQ is a no-no.

    I presume by this you mean no shortcode on the generated schema but OK in the actual page FAQ text – as it gets rendered as html anyway.Is that correct?

    I have tested in SDTT and it seems OK but it would be great if you could just confirm that’s what you meant

    I think page FAQs in spoilers work very well:

    https://tamingthesaxophone.com/beginners-questions

    https://search.google.com/structured-data/testing-tool/u/0/#url=https%3A%2F%2Ftamingthesaxophone.com%2Fbeginners-questions

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 14 replies - 1 through 14 (of 14 total)

The ticket ‘FAQ Schema structured data’ is closed to new replies.