Breadcrumbs Schema (in Json-ld) Template for Blog-wide Use
SOLVE
Hi,
I've recently learnt about a way to add a schema markup template using hubl tokens in the <head> of a blog so that every single blog post has its article/blog schema auto-generated when published (check that out if you need it).
That's great and I'm trying to do the same and generate a schema markup template using hubl tokens with my blog posts' breadcrumbs too.
I got something to work however i'm stuck when trying to generate the breadcrumbs schema for a blog post that has several paths:
I want to be able to recreate those 4 paths in my breadcrumbs schema markup template - Here's the code I have so far:
-----------------------------------
<script type="application/ld+json"> {% set regionList = ["teach-english-in-europe", "teach-english-in-asia", "teach-english-in-latin-america", "teach-english-in-middle-east", "teach-english-in-middle-east"] %} {% set countryList = [ "teach-english-in-austria", "teach-english-in-belgium", "teach-english-in-czech-republic", "teach-english-in-croatia", "teach-english-in-france", "teach-english-in-georgia", "teach-english-in-germany", "teach-english-in-hungary", "teach-english-in-italy", "teach-english-in-netherlands", "teach-english-in-poland", "teach-english-in-portugal", "teach-english-in-romania", "teach-english-in-russia", "teach-english-in-spain", "teach-english-in-turkey", "teach-english-in-cambodia", "teach-english-in-china", "teach-english-in-hong-kong", "teach-english-in-india", "teach-english-in-indonesia", "teach-english-in-japan", "teach-english-in-malaysia", "teach-english-in-myanmar", "teach-english-in-singapore", "teach-english-in-south-korea", "teach-english-in-taiwan", "teach-english-in-thailand", "teach-english-in-vietnam", "teach-english-in-argentina", "teach-english-in-bolivia", "teach-english-in-brazil", "teach-english-in-chile", "teach-english-in-colombia", "teach-english-in-costa-rica", "teach-english-in-dominican-republic", "teach-english-in-ecuador", "teach-english-in-mexico", "teach-english-in-peru", "teach-english-in-uruguay", "teach-english-in-bahrain", "teach-english-in-egypt", "teach-english-in-iraq", "teach-english-in-israel", "teach-english-in-jordan", "teach-english-in-kuwait", "teach-english-in-lebanon", "teach-english-in-morocco", "teach-english-in-oman", "teach-english-in-palestine", "teach-english-in-saudi-arabia", "teach-english-in-tunisia", "teach-english-in-turkey", "teach-english-in-united-arab-emirates" ] %} {% set regionItem = [] %} {% set countryItem = [] %} {% for topic in content.topic_list %} {% if regionList is containing topic.slug %} {% set region_new = regionItem.append({"slug": topic.slug, "name": topic.name}) %} {% endif %} {% if countryList is containing topic.slug %} {% set country_new = countryItem.append({"slug": topic.slug, "name": topic.name}) %} {% endif %} {% endfor %} [{ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [ { "@type": "ListItem", "position": 1, "name": "Home", "item": "https://www.internationalteflacademy.com/" }, { "@type": "ListItem", "position": 2, "name": "Blog", "item": "{{ group.absolute_url }}" },{% if regionItem != "[]" and countryItem != "[]" %} { "@type": "ListItem", "position": 3, "name": "{% for item in regionItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in regionItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" }, { "@type": "ListItem", "position": 4, "name": "{% for item in countryItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in countryItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" }, { "@type": "ListItem", "position": 5, "name": "{{ content.name|striptags }}" } {% elif regionItem != "[]" and countryItem != "false" %} { "@type": "ListItem", "position": 3, "name": "{% for item in regionItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in regionItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" },{ "@type": "ListItem", "position": 4, "name": "{{ content.name|striptags }}" } {% elif regionItem != "false" and countryItem != "[]"%} { "@type": "ListItem", "position": 3, "name": "{% for item in countryItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in countryItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" }, { "@type": "ListItem", "position": 4, "name": "{{ content.name|striptags }}" } {%else%} { "@type": "ListItem", "position": 3, "name": "{{ content.name|striptags }}" } {% endif %}]}
{% for item in regionItem %}{% if not loop.last %},{ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://www.internationalteflacademy.com/" }, { "@type": "ListItem", "position": 2, "name": "Blog", "item": "{{ group.absolute_url }}" },{% if regionItem != "[]" and countryItem != "[]" %} { "@type": "ListItem", "position": 3, "name": "{% for item in regionItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in regionItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" }, { "@type": "ListItem", "position": 4, "name": "{% for item in countryItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in countryItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" }, { "@type": "ListItem", "position": 5, "name": "{{ content.name|striptags }}" } {% elif regionItem != "[]" and countryItem != "false" %} { "@type": "ListItem", "position": 3, "name": "{% for item in regionItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in regionItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" },{ "@type": "ListItem", "position": 4, "name": "{{ content.name|striptags }}" } {% elif regionItem != "false" and countryItem != "[]"%} { "@type": "ListItem", "position": 3, "name": "{% for item in countryItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in countryItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" }, { "@type": "ListItem", "position": 4, "name": "{{ content.name|striptags }}" } {%else%} { "@type": "ListItem", "position": 3, "name": "{{ content.name|striptags }}" } {% endif %}]}{% endif %}{% endfor %}
{% for item in countryItem %}{% if not loop.last %},{ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://www.internationalteflacademy.com/" }, { "@type": "ListItem", "position": 2, "name": "Blog", "item": "{{ group.absolute_url }}" },{% if regionItem != "[]" and countryItem != "[]" %} { "@type": "ListItem", "position": 3, "name": "{% for item in regionItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in regionItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" }, { "@type": "ListItem", "position": 4, "name": "{% for item in countryItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in countryItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" }, { "@type": "ListItem", "position": 5, "name": "{{ content.name|striptags }}" } {% elif regionItem != "[]" and countryItem != "false" %} { "@type": "ListItem", "position": 3, "name": "{% for item in regionItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in regionItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" },{ "@type": "ListItem", "position": 4, "name": "{{ content.name|striptags }}" } {% elif regionItem != "false" and countryItem != "[]"%} { "@type": "ListItem", "position": 3, "name": "{% for item in countryItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}", "item": "{% for item in countryItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}" }, { "@type": "ListItem", "position": 4, "name": "{{ content.name|striptags }}" } {%else%} { "@type": "ListItem", "position": 3, "name": "{{ content.name|striptags }}" } {% endif %}]}
{% endif %}{% endfor %}
] </script>
-----------------------------------
With this code, I do generate 4 breacrumb items like i want to for this post example.
However - instead of pulling the spain item once, the brazil item once, the germany item once, and the italy item once - it pulls all of them together in the same iteration 4 times.
See this screenshot:
Obviously - I'm not trying to get someone to write the code for me for free, i'm just wondering if someone can put me in the right direction so i can pull one item at a time in that breadcrumb schema markup?
Before starting, I forgot to welcome you to the Technical SEO on Hubspot part. Hubspot does alot of stuff correct, but structured data and other Technical SEO related subjects is not one of them.... Sorry you have to, like us, build everything yourself!
Looking at your code, I think something goes wrong here:
{% set regionItem = [] %}
{% set countryItem = [] %}
{% for topic in content.topic_list %}
{% if regionList is containing topic.slug %}
{% set region_new = regionItem.append({"slug": topic.slug, "name": topic.name}) %}
{% endif %}
{% if countryList is containing topic.slug %}
{% set country_new = countryItem.append({"slug": topic.slug, "name": topic.name}) %}
{% endif %}
{% endfor %}
You are creating a "region_new" and "country_new" variable and filling it with some data. Yet, the variable is not used anythwere else, only the regionItem and countryItem itself.
My guess on how debugging this is simply outputting every variable on the spot and see what you are working with. Somewhere, the loop get's more data than it should.
If you are getting stuck, give me a message. I think the easiest way for me helping you out, is to look have a look at the module inside your portal. Otherwise i have to create all the variables myself, that would take a while 😅
Breadcrumbs Schema (in Json-ld) Template for Blog-wide Use
SOLVE
@Sjardo I wanted to thank you again for your help with this. I was able to make something work. It's now implemented on my blog and everything works well. Thanks again!
Breadcrumbs Schema (in Json-ld) Template for Blog-wide Use
SOLVE
@Sjardo I wanted to thank you again for your help with this. I was able to make something work. It's now implemented on my blog and everything works well. Thanks again!
Before starting, I forgot to welcome you to the Technical SEO on Hubspot part. Hubspot does alot of stuff correct, but structured data and other Technical SEO related subjects is not one of them.... Sorry you have to, like us, build everything yourself!
Looking at your code, I think something goes wrong here:
{% set regionItem = [] %}
{% set countryItem = [] %}
{% for topic in content.topic_list %}
{% if regionList is containing topic.slug %}
{% set region_new = regionItem.append({"slug": topic.slug, "name": topic.name}) %}
{% endif %}
{% if countryList is containing topic.slug %}
{% set country_new = countryItem.append({"slug": topic.slug, "name": topic.name}) %}
{% endif %}
{% endfor %}
You are creating a "region_new" and "country_new" variable and filling it with some data. Yet, the variable is not used anythwere else, only the regionItem and countryItem itself.
My guess on how debugging this is simply outputting every variable on the spot and see what you are working with. Somewhere, the loop get's more data than it should.
If you are getting stuck, give me a message. I think the easiest way for me helping you out, is to look have a look at the module inside your portal. Otherwise i have to create all the variables myself, that would take a while 😅
Breadcrumbs Schema (in Json-ld) Template for Blog-wide Use
SOLVE
@Sjardo I need to do some more testing but i may have something that can work. I simplified the hubl markup a bit and removed some unnecessary "{% for item in items}" markups that were overruling pre-existing ones and prevented them from firing correctly, hence why i would get all 4 iterations every time. Will keep you posted if I get it to work everywhere. Thank you!
<script type="application/ld+json">
{% set regionList = ["teach-english-in-europe", "teach-english-in-asia", "teach-english-in-latin-america", "teach-english-in-middle-east", "teach-english-in-middle-east"] %}
{% set countryList = [ "teach-english-in-austria", "teach-english-in-belgium", "teach-english-in-czech-republic", "teach-english-in-croatia", "teach-english-in-france", "teach-english-in-georgia", "teach-english-in-germany", "teach-english-in-hungary", "teach-english-in-italy", "teach-english-in-netherlands", "teach-english-in-poland", "teach-english-in-portugal", "teach-english-in-romania", "teach-english-in-russia", "teach-english-in-spain", "teach-english-in-turkey", "teach-english-in-cambodia", "teach-english-in-china", "teach-english-in-hong-kong", "teach-english-in-india", "teach-english-in-indonesia", "teach-english-in-japan", "teach-english-in-malaysia", "teach-english-in-myanmar", "teach-english-in-singapore", "teach-english-in-south-korea", "teach-english-in-taiwan", "teach-english-in-thailand", "teach-english-in-vietnam", "teach-english-in-argentina", "teach-english-in-bolivia", "teach-english-in-brazil", "teach-english-in-chile", "teach-english-in-colombia", "teach-english-in-costa-rica", "teach-english-in-dominican-republic", "teach-english-in-ecuador", "teach-english-in-mexico", "teach-english-in-peru", "teach-english-in-uruguay", "teach-english-in-bahrain", "teach-english-in-egypt", "teach-english-in-iraq", "teach-english-in-israel", "teach-english-in-jordan", "teach-english-in-kuwait", "teach-english-in-lebanon", "teach-english-in-morocco", "teach-english-in-oman", "teach-english-in-palestine", "teach-english-in-saudi-arabia", "teach-english-in-tunisia", "teach-english-in-turkey", "teach-english-in-united-arab-emirates" ] %}
{% set regionItem = [] %}
{% set countryItem = [] %}
{% for topic in content.topic_list %}
{% if regionList is containing topic.slug %}
{% set region_new = regionItem.append({"slug": topic.slug, "name": topic.name}) %}
{% endif %}
{% if countryList is containing topic.slug %}
{% set country_new = countryItem.append({"slug": topic.slug, "name": topic.name}) %}
{% endif %}
{% endfor %}
[{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "{{ group.absolute_url }}"
},{% if regionItem != "[]" and countryItem != "[]" %} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in regionItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in regionItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{% for item in countryItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in countryItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 5,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "[]" and countryItem != "false" %} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in regionItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in regionItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
},{
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "false" and countryItem != "[]"%} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in countryItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in countryItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{%else%} {
"@type": "ListItem",
"position": 3,
"name": "{{ content.name|striptags }}"
}
{% endif %}]}
{% for item in regionItem %}{% if not loop.first and regionItem|length > 1 %},{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "{{ group.absolute_url }}"
},{% if regionItem != "[]" and countryItem != "[]" %} {
"@type": "ListItem",
"position": 3,
"name": "{{ item.name|replace('Teach English in','') }}",
"item": "{{ blog_tag_url(group.id, item.slug) }}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{% for item in countryItem %}{{ item.name|replace('Teach English in','') }}",
"item": "{% for item in countryItem %}{{ blog_tag_url(group.id, item.slug) }}"
}, {
"@type": "ListItem",
"position": 5,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "[]" and countryItem != "false" %} {
"@type": "ListItem",
"position": 3,
"name": "{{ item.name|replace('Teach English in','') }}",
"item": "{{ blog_tag_url(group.id, item.slug) }}{% endif %}"
},{
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{% endif %}]}{% endif %}{% endfor %}
{% for item in countryItem %}{% if not loop.first and countryItem|length > 1 %},{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "{{ group.absolute_url }}"
},{% if regionItem != "[]" and countryItem != "[]" %} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in regionItem %}{{ item.name|replace('Teach English in','') }}{% endfor %}",
"item": "{% for item in regionItem %}{{ blog_tag_url(group.id, item.slug) }}{% endfor %}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{{ item.name|replace('Teach English in','') }}",
"item": "{{ blog_tag_url(group.id, item.slug) }}"
}, {
"@type": "ListItem",
"position": 5,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "false" and countryItem != "[]"%} {
"@type": "ListItem",
"position": 3,
"name": "{{ item.name|replace('Teach English in','') }}",
"item": "{{ blog_tag_url(group.id, item.slug) }}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{% endif %}]}
{% endif %}{% endfor %}
]
</script>
Breadcrumbs Schema (in Json-ld) Template for Blog-wide Use
SOLVE
Thanks, @Sjardo ! Yeah it pulls any relevant item from these 2 lists and remove the "teach-english-in" part so only the country or region remains in the breadcrumbs.
I guess other than that using the loop hubl markup, i'm not sure what i could write in the schema so that if i have 4 breadcrumb paths for one article - that is 4 items within a loop - like in this example, i can pull the first item "n" in the first breadcrumb schema, "n+1" item in the second, "n+2" item in the third, "n+3" and so on. When it's only 1 or 2 items, i have no issues with my schema code above), but when it gets to 3,4,etc that's where i can't make it work. Probably because i might not know the correct hubl markup and code to use to make it work - anything you could share to point me in the right direction is appreciated. Thank you!
If that helps, here's the breadcrumb code as currently displayed on my blog template, and in this article example here
Breadcrumbs Schema (in Json-ld) Template for Blog-wide Use
SOLVE
Hi,
Withouth testing the code, my first guess is probably something you already tried.
It looks like the spots where you want to insert the Name of the country and the slug, you simply loop over all selected countries instead just the one selected / read from the slug.
{% for item in regionItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}
I think, in the above example that also could be countryItem, you loop over more than 1 item. I think you selected that somewhere or the filter is not working properly.
Could you output everything inside the for loop for {{item}} and tell me what it contains? If it gives back multiple values (as in, multiple countries), you got the problem 🙂
Breadcrumbs Schema (in Json-ld) Template for Blog-wide Use
SOLVE
Hi @natsumimori@Sjardo@jonchim@Indra - and thank you for taking a look! Sorry for the delayed follow-up, I was out until today. Here's the code in a code block below. I'm more familiar with jsonLD than with microdata, but i'm open to anything that can work! Thank you so much!
Here's the code i use:
<script type="application/ld+json">
{% set regionList = ["teach-english-in-europe", "teach-english-in-asia", "teach-english-in-latin-america", "teach-english-in-middle-east", "teach-english-in-middle-east"] %}
{% set countryList = [ "teach-english-in-austria", "teach-english-in-belgium", "teach-english-in-czech-republic", "teach-english-in-croatia", "teach-english-in-france", "teach-english-in-georgia", "teach-english-in-germany", "teach-english-in-hungary", "teach-english-in-italy", "teach-english-in-netherlands", "teach-english-in-poland", "teach-english-in-portugal", "teach-english-in-romania", "teach-english-in-russia", "teach-english-in-spain", "teach-english-in-turkey", "teach-english-in-cambodia", "teach-english-in-china", "teach-english-in-hong-kong", "teach-english-in-india", "teach-english-in-indonesia", "teach-english-in-japan", "teach-english-in-malaysia", "teach-english-in-myanmar", "teach-english-in-singapore", "teach-english-in-south-korea", "teach-english-in-taiwan", "teach-english-in-thailand", "teach-english-in-vietnam", "teach-english-in-argentina", "teach-english-in-bolivia", "teach-english-in-brazil", "teach-english-in-chile", "teach-english-in-colombia", "teach-english-in-costa-rica", "teach-english-in-dominican-republic", "teach-english-in-ecuador", "teach-english-in-mexico", "teach-english-in-peru", "teach-english-in-uruguay", "teach-english-in-bahrain", "teach-english-in-egypt", "teach-english-in-iraq", "teach-english-in-israel", "teach-english-in-jordan", "teach-english-in-kuwait", "teach-english-in-lebanon", "teach-english-in-morocco", "teach-english-in-oman", "teach-english-in-palestine", "teach-english-in-saudi-arabia", "teach-english-in-tunisia", "teach-english-in-turkey", "teach-english-in-united-arab-emirates" ] %}
{% set regionItem = [] %}
{% set countryItem = [] %}
{% for topic in content.topic_list %}
{% if regionList is containing topic.slug %}
{% set region_new = regionItem.append({"slug": topic.slug, "name": topic.name}) %}
{% endif %}
{% if countryList is containing topic.slug %}
{% set country_new = countryItem.append({"slug": topic.slug, "name": topic.name}) %}
{% endif %}
{% endfor %}
[{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "{{ group.absolute_url }}"
},{% if regionItem != "[]" and countryItem != "[]" %} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in regionItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in regionItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{% for item in countryItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in countryItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 5,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "[]" and countryItem != "false" %} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in regionItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in regionItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
},{
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "false" and countryItem != "[]"%} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in countryItem %}{% if loop.first %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in countryItem %}{% if loop.first %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{%else%} {
"@type": "ListItem",
"position": 3,
"name": "{{ content.name|striptags }}"
}
{% endif %}]}
{% for item in regionItem %}{% if not loop.last %},{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "{{ group.absolute_url }}"
},{% if regionItem != "[]" and countryItem != "[]" %} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in regionItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in regionItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{% for item in countryItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in countryItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 5,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "[]" and countryItem != "false" %} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in regionItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in regionItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
},{
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "false" and countryItem != "[]"%} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in countryItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in countryItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{%else%} {
"@type": "ListItem",
"position": 3,
"name": "{{ content.name|striptags }}"
}
{% endif %}]}{% endif %}{% endfor %}
{% for item in countryItem %}{% if not loop.last %},{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "{{ group.absolute_url }}"
},{% if regionItem != "[]" and countryItem != "[]" %} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in regionItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in regionItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{% for item in countryItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in countryItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 5,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "[]" and countryItem != "false" %} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in regionItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in regionItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
},{
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{% elif regionItem != "false" and countryItem != "[]"%} {
"@type": "ListItem",
"position": 3,
"name": "{% for item in countryItem %}{% if not loop.last %}{{ item.name|replace('Teach English in','') }}{% endif %}{% endfor %}",
"item": "{% for item in countryItem %}{% if not loop.last %}{{ blog_tag_url(group.id, item.slug) }}{% endif %}{% endfor %}"
}, {
"@type": "ListItem",
"position": 4,
"name": "{{ content.name|striptags }}"
}
{%else%} {
"@type": "ListItem",
"position": 3,
"name": "{{ content.name|striptags }}"
}
{% endif %}]}
{% endif %}{% endfor %}
]
</script>
and here's what shows up on the article:
<script type="application/ld+json">
[{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[
{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "https://www.internationalteflacademy.com/blog"
}, {
"@type": "ListItem",
"position": 3,
"name": " Spain",
"item": "https://www.internationalteflacademy.com/blog/topic/teach-english-in-spain"
}, {
"@type": "ListItem",
"position": 4,
"name": "9 Reasons to Love the World Cup while Teaching English Abroad"
}
]}
,{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "https://www.internationalteflacademy.com/blog"
}, {
"@type": "ListItem",
"position": 3,
"name": " Spain Brazil Germany",
"item": "https://www.internationalteflacademy.com/blog/topic/teach-english-in-spainhttps://www.internationalteflacademy.com/blog/topic/teach-english-in-brazilhttps://www.internationalteflacademy.com/blog/topic/teach-english-in-germany"
}, {
"@type": "ListItem",
"position": 4,
"name": "9 Reasons to Love the World Cup while Teaching English Abroad"
}
]}
,{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "https://www.internationalteflacademy.com/blog"
}, {
"@type": "ListItem",
"position": 3,
"name": " Spain Brazil Germany",
"item": "https://www.internationalteflacademy.com/blog/topic/teach-english-in-spainhttps://www.internationalteflacademy.com/blog/topic/teach-english-in-brazilhttps://www.internationalteflacademy.com/blog/topic/teach-english-in-germany"
}, {
"@type": "ListItem",
"position": 4,
"name": "9 Reasons to Love the World Cup while Teaching English Abroad"
}
]}
,{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement":
[{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.internationalteflacademy.com/"
}, {
"@type": "ListItem",
"position": 2,
"name": "Blog",
"item": "https://www.internationalteflacademy.com/blog"
}, {
"@type": "ListItem",
"position": 3,
"name": " Spain Brazil Germany",
"item": "https://www.internationalteflacademy.com/blog/topic/teach-english-in-spainhttps://www.internationalteflacademy.com/blog/topic/teach-english-in-brazilhttps://www.internationalteflacademy.com/blog/topic/teach-english-in-germany"
}, {
"@type": "ListItem",
"position": 4,
"name": "9 Reasons to Love the World Cup while Teaching English Abroad"
}
]}
]
</script>
Breadcrumbs Schema (in Json-ld) Template for Blog-wide Use
SOLVE
Hi,
Can you post your code in a code block, that should give a better look how the could has to look.
We build our Breadcrumbs schema with mircrodata, beceause transforming the breadcrumbs into a jsonLD script is much harder (possible, but hard). This way, you just have to itterate over the breadcrumbs and add the correct schema.