Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
please provide a valid dynamic breadcrumb schema JSON-LD script
Solved! Go to the solution
This is an accepted solution.
@LookandAdorn Please find the code below:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "{{ shop.url }}"
},
{%- if template == 'collection' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ collection.title }}",
"item": "{{ collection.url }}"
}
{%- elsif template == 'product' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ collection.title }}",
"item": "{{ collection.url }}"
},
{
"@type": "ListItem",
"position": 3,
"name": "{{ product.title }}",
"item": "{{ product.url }}"
}
{%- else -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ page.title }}",
"item": "{{ shop.url }}{{ request.path }}"
}
{%- endif -%}
]
}
</script>
This is an accepted solution.
@LookandAdorn Please use updated one
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "{{ shop.url }}"
},
{%- if template == 'collection' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ collection.title }}",
"item": "{{ collection.url }}"
}
{%- elsif template == 'product' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ product.title }}",
"item": "{{ product.url }}"
}
{%- else -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ page.title }}",
"item": "{{ shop.url }}{{ request.path }}"
}
{%- endif -%}
]
}
</script>
This is an accepted solution.
@LookandAdorn Please find the code below:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "{{ shop.url }}"
},
{%- if template == 'collection' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ collection.title }}",
"item": "{{ collection.url }}"
}
{%- elsif template == 'product' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ collection.title }}",
"item": "{{ collection.url }}"
},
{
"@type": "ListItem",
"position": 3,
"name": "{{ product.title }}",
"item": "{{ product.url }}"
}
{%- else -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ page.title }}",
"item": "{{ shop.url }}{{ request.path }}"
}
{%- endif -%}
]
}
</script>
Getting the below mentioned error -
https://search.google.com/test/rich-results/result/r%2Fbreadcrumbs?id=iXdYNY8SDyGgPHYlIrJEBw
This is an accepted solution.
@LookandAdorn Please use updated one
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "{{ shop.url }}"
},
{%- if template == 'collection' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ collection.title }}",
"item": "{{ collection.url }}"
}
{%- elsif template == 'product' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ product.title }}",
"item": "{{ product.url }}"
}
{%- else -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ page.title }}",
"item": "{{ shop.url }}{{ request.path }}"
}
{%- endif -%}
]
}
</script>
@webwondersco wrote:@LookandAdorn Please use updated one
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "{{ shop.url }}"
},
{%- if template == 'collection' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ collection.title }}",
"item": "{{ collection.url }}"
}
{%- elsif template == 'product' -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ product.title }}",
"item": "{{ product.url }}"
}
{%- else -%}
{
"@type": "ListItem",
"position": 2,
"name": "{{ page.title }}",
"item": "{{ shop.url }}{{ request.path }}"
}
{%- endif -%}
]
}
</script>
Thank you 👍 so much. I appreciate your quick response
Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024Note: Customizing your CSS requires some familiarity with CSS and HTML. Before you cust...
By JasonH Aug 12, 2024