htmlseoschemagoogle-searchmicrodata

Why Google suggesting to use META TAGS in Body?


I was searching about microdata for Google's Sitelink Searchbox. So I found a page on google site.

this is the microdata code -

<div itemscope itemtype="https://schema.org/WebSite">
  <meta itemprop="url" content="https://www.example.com/"/>
  <form itemprop="potentialAction" itemscope itemtype="https://schema.org/SearchAction">
    <meta itemprop="target" content="https://query.example.com/search?q={search_term_string}"/>
    <input itemprop="query-input" type="text" name="search_term_string" required/>
    <input type="submit"/>
  </form>
</div>

URL - > https://developers.google.com/search/docs/advanced/structured-data/sitelinks-searchbox


Solution

  • Some meta tags are allowed inside <div> and <form> tags inside the document body. See <meta>: The metadata element - HTML: HyperText Markup Language | MDN which says:

    Permitted parents

    • ...
    • <meta itemprop>: any element that accepts metadata content or flow content.

    From the page about flow content, the elements that allow flow content include both <div> and <form> which are used in the <body>.

    So while many meta tags only belong in the <head>, when a meta tag has itemprop it can go in the <body> (or in the <head>).