TVBZ
TVBZ

Reputation: 594

How to add itemscope to <html> tag in Joomla?

I have a FAQ page set up with rich snippets. Google Search does not recognize it. I still need to add itemscope itemtype="https://schema.org/FAQPage" to the html tag.

How could I modify the html tag for 1 specific page? My html tag currently looks like this:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr">
...
</html>

How can I add the code and make it look like this? For only 1 page?

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr" itemscope itemtype="https://schema.org/FAQPage>
...
</html>

Many thanks for any tips on this.

PS: I have the HeadTag plugin installed from RicheyWeb. This makes it easy to add something to the head of my page. But I can't add to the html tag directly.

Upvotes: 1

Views: 102

Answers (1)

David Taiaroa
David Taiaroa

Reputation: 25485

If it's feasible for your page, have you considered placing your structured data inside a JSON snippet on the page?

I've included a sample JSON script for an FAQ page below.

Here's how it looks on a page: https://codepen.io/panchroma/pen/zYYaRea

And this page validates on the Google Structured Snippet Validator,

screenshot below.

enter image description here]

FWIW, here's an online generator for an FAQ Structured Data JSON snippet

I hope this helps, good luck!

Sample FAQ JSON snippet

<script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "FAQPage",
      "mainEntity": [
        {
          "@type": "Question",
          "name": "Question 1",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Answer 1"
          }
        },
        {
          "@type": "Question",
          "name": "Question 2",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Answer 2"
          }
        }
      ]
    }
</script>  

Upvotes: 0

Related Questions