-
Notifications
You must be signed in to change notification settings - Fork 87
/
breadcrumbs.html
53 lines (53 loc) · 1.89 KB
/
breadcrumbs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{%- if page %}
{% set parent_url = ("/" + "/".join(page.url.split("/")[:-2]) + "/")
| replace("/support/wn/", "/support/whats-new/") %}
{# Breadcrumbs are defined literally for pages that don't have ancestors: #}
{% set breadcrumbs = {
"/support/archives/": [
{ "url": "/support/contact/#archives", "title": "Archives" }
],
"/support/faq/": [
{ "url": "/support/faq/", "title": "FAQ" }
],
"/support/tutorials/": [
{ "url": "/support/tutorials/", "title": "Tutorials" }
],
"/support/training-material/": [
{ "url": "/support/training-material/", "title": "Training material" }
],
"/support/tutorials/env-guide/": [
{ "url": "/support/tutorials/", "title": "Tutorials" },
{ "url": "/support/tutorials/env-guide/", "title": "Linux tutorials" }
],
"/support/tutorials/gis/": [
{ "url": "/support/tutorials/", "title": "Tutorials" },
],
"/support/whats-new/": [
{ "url": "/support/whats-new/", "title": "What's new" }
],
"/apps/": [
{ "url": "/apps/", "title": "Applications" }
]
} %}
<nav class="md-nav csc-breadcrumbs">
{% if not page.is_homepage %}
<a class="csc-breadcrumbs__link" href="{{ base_url }}">Docs CSC</a>
{% endif %}
{%- for ancestor in page.ancestors[::-1] -%}
{% if ancestor.is_page %}
<a class="csc-breadcrumbs__link" href="/{{ ancestor.url }}">{{ ancestor.title }}</a>
{% endif %}
{%- endfor -%}
{% if not page.ancestors and parent_url in breadcrumbs %}
{% for breadcrumb in breadcrumbs[parent_url] %}
<a class="csc-breadcrumbs__link" href="{{ breadcrumb['url'] }}">{{ breadcrumb['title'] }}</a>
{% endfor %}
{% endif %}
{% if not page.is_homepage %}
{{ page.title }}
{% endif %}
</nav>
{% if config.extra.breadcrumbs_debug %}
{% include "partials/breadcrumbs-debug.html" %}
{% endif %}
{%- endif %}