0

I have a page that is structured as https://www.example.com/pages/category.

On this page are three links:

  1. https://www.example.com/shop/mens
  2. https://www.example.com/shop/womens
  3. https://www.example.com/shop/kids

The current schema I have for this page is structured as so:

{
  "@context": "https://schema.org/",
  "@type": "CollectionPage",
  "name": "Name of Page",
  "url": "https://www.example.com/pages/category",
  "description": "Description Goes Here",
  "mainContentOfPage": [
    {
        "@type": "SiteNavigationElement",
        "name": "Anchor Text of Category Link",
        "url": "URL of Category"
    },
    {
        "@type": "SiteNavigationElement",
        "name": "Anchor Text of Category Link",
        "url": "URL of Category"
    },
    {
        "@type": "SiteNavigationElement",
        "name": "Anchor Text of Category Link",
        "url": "URL of Category"
    }
  ]
}

Is this correct? It validates with no errors or warnings.

  • Note that Schema.org terms are case-sensitive. It must be mainContentOfPage instead of mainContentofPage, and SiteNavigationElement instead of siteNavigationElement. I edited your question to fix these. – unor Mar 8 at 3:25
  • Did you move a bracket? That code only validates the CollectionPage, not the SiteNavigationElements. – BAM Mar 8 at 17:58
  • Nope, my changes don’t seem to be responsible for this. Your original version has the same issue. The problem is in line 7: the } needs to be removed. (I edited again to fix it.) – unor Mar 9 at 3:08
1

SiteNavigationElement is most likely meant to represent the whole navigation, not the single links the navigation consists of. To provide data about each link, you could use SiteNavigationElement together with an ItemList (example).

That said, I’m not convinced that mainContentOfPage and SiteNavigationElement are suitable for conveying what the page means. The links in question seem to be the content of the page, they are not the site navigation (which is typically in the header).

A pretty basic solution could be using significantLink, but this only allows specifying the URL, not the name:

{
  "@context": "https://schema.org/",
  "@type": "CollectionPage",
  "name": "Name of Page",
  "url": "https://www.example.com/pages/category",
  "description": "Description Goes Here",
  "significantLink": [
    "https://www.example.com/shop/mens",
    "https://www.example.com/shop/womens",
    "https://www.example.com/shop/kids"
  ]
}

A more expressive solution could be using mainEntity (if the three links really are the main content of that page) with an ItemList:

{
  "@context": "https://schema.org/",
  "@type": "CollectionPage",
  "name": "Name of Page",
  "url": "https://www.example.com/pages/category",
  "description": "Description Goes Here",
  "mainEntity": {
    "@type": "ItemList",
    "itemListElement": [
      {
        "@type": "WebPage",
        "name": "Anchor Text of Category Link",
        "url": "URL of Category"
      },
      {
        "@type": "WebPage",
        "name": "Anchor Text of Category Link",
        "url": "URL of Category"
      }
    ]
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.