I asked ChatGPT to create template code for a category schema.
Chat gave me this:
<mvt:comment> Category ItemList Schema </mvt:comment>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "ItemList",
"@id": "https://www.rvparksupplies.com/c/<mvt:eval expr="l.settings:category:code"/>/#category",
"url": "https://www.rvparksupplies.com/c/<mvt:eval expr="l.settings:category:code"/>/",
"name": "<mvt:eval expr="l.settings:category:name"/>",
"itemListOrder": "Ascending",
"numberOfItems": <mvt:eval expr="l.settings:category:product_count"/>,
"itemListElement": [
<mvt:foreach iterator="product" array="products">
{
"@type": "ListItem",
"position": <mvt:eval expr="product:pos"/>,
"url": "https://www.rvparksupplies.com/p/<mvt:eval expr="product:code"/>/"
}<mvt:if expr="product:pos LT l.settings:category:product_count">,</mvt:if>
</mvt:foreach>
]
}
</script>
It kind of works giving me this:
But neither the position or url are correct.
Maybe Miva has working template code to create the category schema?
Chat gave me this:
<mvt:comment> Category ItemList Schema </mvt:comment>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "ItemList",
"@id": "https://www.rvparksupplies.com/c/<mvt:eval expr="l.settings:category:code"/>/#category",
"url": "https://www.rvparksupplies.com/c/<mvt:eval expr="l.settings:category:code"/>/",
"name": "<mvt:eval expr="l.settings:category:name"/>",
"itemListOrder": "Ascending",
"numberOfItems": <mvt:eval expr="l.settings:category:product_count"/>,
"itemListElement": [
<mvt:foreach iterator="product" array="products">
{
"@type": "ListItem",
"position": <mvt:eval expr="product:pos"/>,
"url": "https://www.rvparksupplies.com/p/<mvt:eval expr="product:code"/>/"
}<mvt:if expr="product:pos LT l.settings:category:product_count">,</mvt:if>
</mvt:foreach>
]
}
</script>
It kind of works giving me this:
| <script type="application/ld+json"> |
| { |
| "@context": "https://schema.org", |
| "@type": "ItemList", |
| "@id": "https://www.rvparksupplies.com/c/RVPowerOutlet/#category", |
| "url": "https://www.rvparksupplies.com/c/RVPowerOutlet/", |
| "name": "RV Power Outlet Boxes", |
| "itemListOrder": "Ascending", |
| "numberOfItems": , |
| "itemListElement": [ |
| { |
| "@type": "ListItem", |
| "position": , |
| "url": "https://www.rvparksupplies.com/p//" |
| } |
Maybe Miva has working template code to create the category schema?
Comment