Sign in

Looking For The Best Way To Include Schema Markup

  • This topic has 6 replies, 3 voices, and was last updated 5 months, 3 weeks ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6740
    Andy

    Hello, I’m looking for the best way to include Schema Markup in a theme. Do you have an idea ?

    Specially, I am looking to include the recipe schema markup in the Taste or Technews theme

     

    Thank you in advance for your ideas

     

    #6753
    candidexmedia

    Hi @Andy! Not sure if this is what you mean, but is it similar to breadcrumbs? If so, I have a few web pages bookmarked on that topic that seem to mention schema:

    “Breadcrumb and multilanguage” – code snippet for index.hbs by @Bob, one of the devs: https://forum.getpublii.com/topic/breadcrumb-and-multilanguage/

    “Breadcrumbs for Publii” – similar as above but with CSS code snippet: https://cv.domagic.site/posts/breadcrumbs-for-publii

    “Folder Structure” – helper by @t79 to generate breadcrumbs</span>: https://forum.getpublii.com/topic/folder-structure/

     

    #6754
    Andy

    Hello !

    Thanks for the feedback! Sorry if it’s not very clear. I’m looking to include this: https://developers.google.com/search/docs/advanced/structured-data/recipe

    JSON-LD code in the head tag for each article

    #6756
    chris

    The script doesn’t actually have to go into the document head. From the Google Developers page:

    JSON-LD* (Recommended)
    A JavaScript notation embedded in a script tag in the page head or body.

    If you need schema markup specific to each individual post you can edit the HTML in the WYSIWYG editor, (or, if using the Block editor do an HTML block), so that it appears at the end of each post.

    #6758
    candidexmedia

    For some reason, my reply didn’t send, so I’ll try again

    #6760
    candidexmedia

    Andy wrote:

    Hello !

    Thanks for the feedback! Sorry if it’s not very clear. I’m looking to include this: https://developers.google.com/search/docs/advanced/structured-data/recipe

    JSON-LD code in the head tag for each article

    Thanks for the clarification. I would try out what Chris mentioned and see if that works.

    Otherwise, if it must be in the <head>, I would go about it this way: https://gist.github.com/candidexmedia/6304251e0bc2baf7ee07565b4f6fac49

    Unfortunately, the Publii forum seems to have blocked my reply, so I made a gist with the code snippets and instructions.

    #6770
    Andy

    Thank you both for your answers.

     



    @chris
    :

    OMG, I had never seen that you could put that in the body tag! It seems the easiest!

    How can I retrieve dynamic information?
    Publii tags don’t seem to work in HMTL code if I put this in HTML code of a post

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