-
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35c95c0
commit bc1f5f2
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% macro render(nav_item, ref = nav_item) %} | ||
{% if nav_item.children %} | ||
{% set first = nav_item.children | first %} | ||
{% if first.children %} | ||
{{ render(first, ref) }} | ||
{% else %} | ||
<a href="{{ first.canonical_url | url }}" class="md-path__link" property="item" typeof="WebPage"> | ||
<span class="md-ellipsis" property="name"> | ||
{{ ref.title }} | ||
</span> | ||
</a> | ||
{% endif %} | ||
{% else %} | ||
<a href="{{ nav_item.canonical_url | url }}" class="md-path__link" property="item" typeof="WebPage"> | ||
<span class="md-ellipsis" property="name"> | ||
{{ ref.title }} | ||
</span> | ||
</a> | ||
{% endif %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% import "partials/path-item.html" as item with context %} | ||
{% if page.meta and page.meta.hide %} | ||
{% set hidden = "hidden" if "path" in page.meta.hide %} | ||
{% endif %} | ||
{% set depth = page.ancestors | length %} | ||
{% if nav.homepage %} | ||
{% set depth = depth + 1 %} | ||
{% endif %} | ||
{% if depth > 1 %} | ||
{% set count = namespace(value=1) %} | ||
<nav class="md-path" aria-label="{{ lang.t('nav') }}" {{ hidden }}> | ||
<ol class="md-path__list" vocab="https://schema.org/" typeof="BreadcrumbList"> | ||
{% if nav.homepage %} | ||
<li class="md-path__item" property="itemListElement" typeof="ListItem"> | ||
{{ item.render(nav.homepage) }} | ||
<meta property="position" content="{{ count.value }}"> | ||
{% set count.value = count.value + 1 %} | ||
</li> | ||
{% endif %} | ||
{% for nav_item in page.ancestors | reverse %} | ||
<li class="md-path__item" property="itemListElement" typeof="ListItem"> | ||
{{ item.render(nav_item) }} | ||
<meta property="position" content="{{ count.value }}"> | ||
{% set count.value = count.value + 1 %} | ||
</li> | ||
{% endfor %} | ||
<li class="md-path__item" property="itemListElement" typeof="ListItem"> | ||
<span class="md-ellipsis" property="name">{{ page.title }}</span> | ||
<meta property="position" content="{{ count.value }}"> | ||
</li> | ||
</ol> | ||
</nav> | ||
{% endif %} |