Skip to content

Commit 7bf1ab7

Browse files
add breadcrumb schema to base template
1 parent c0e8dec commit 7bf1ab7

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tbx/project_styleguide/templates/patterns/base.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
{% block meta_tags %}{% endblock %}
3131

32+
{% include "patterns/navigation/components/breadcrumbs-jsonld.html" %}
33+
3234
{% block extra_jsonld %}{% endblock %}
3335

3436
<link rel="stylesheet" type="text/css" href="{% static 'css/main.css' %}">
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{% load wagtailcore_tags %}
2+
{% wagtail_site as current_site %}
3+
{% if page.breadcrumbs %}
4+
<script type="application/ld+json">
5+
{
6+
"@context": "https://schema.org/",
7+
"@type": "BreadcrumbList",
8+
"itemListElement": [{% for crumb in page.breadcrumbs %}
9+
{
10+
"@type": "ListItem",
11+
"position": {{ forloop.counter }},
12+
"name": "{% if crumb.depth == 2 %}Home{% else %}{{ crumb.title|escapejs }}{% endif %}",
13+
"item": "{{ current_site.root_url }}{% pageurl crumb %}"
14+
}{% if not forloop.last %},{% endif %}{% endfor %}
15+
]
16+
}
17+
</script>
18+
{% endif %}

0 commit comments

Comments
 (0)