Re: Need a Dynamic Breadcrumb Schema JSON-Ld script for shopify 2.0

Solved

Need a Dynamic Breadcrumb Schema JSON-Ld script for shopify 2.0

LookandAdorn
Tourist
9 0 1

please provide a valid dynamic breadcrumb schema JSON-LD script 

Accepted Solutions (2)

webwondersco
Shopify Partner
1164 169 170

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>
Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram

View solution in original post

webwondersco
Shopify Partner
1164 169 170

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>
Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram

View solution in original post

Replies 4 (4)

webwondersco
Shopify Partner
1164 169 170

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>
Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
LookandAdorn
Tourist
9 0 1
webwondersco
Shopify Partner
1164 169 170

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>
Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
LookandAdorn
Tourist
9 0 1

@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