diff options
Diffstat (limited to 'templates/macros.html')
-rw-r--r-- | templates/macros.html | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..6c6020a --- /dev/null +++ b/templates/macros.html @@ -0,0 +1,71 @@ +{% macro tags(tags) %} + {% for tag in tags -%} + <a href="{{ get_taxonomy_url(kind="tags", name=tag ) }}">#{{ tag }}</a> + {% endfor -%} +{% endmacro tags %} +{% macro nav_item(name, url) %} + {%- if page %} + {%- set this = page %} + {%- elif section %} + {%- set this = section %} + {%- endif %} + <a {% if this.permalink == url %}class="active"{%- endif %} href={{ url }}>{{ name }}</a> +{% endmacro nav %} +{% macro toc(page) %} + {% if page.toc %} + <nav class="toc"> + <ul> + {% for h1 in page.toc %} + <li> + <a href="{{ h1.permalink | safe }}">{{ h1.title }}</a> + {% if h1.children %} + <ul> + {% for h2 in h1.children %} + <li> + <a href="{{ h2.permalink | safe }}">{{ h2.title }}</a> + </li> + {% if h2.children %} + <ul> + {% for h3 in h2.children %} + <li> + <a href="{{ h3.permalink | safe }}">{{ h3.title }}</a> + {% if h3.children %} + <ul> + {% for h4 in h3.children %} + <li> + <a href="{{ h4.permalink | safe }}">{{ h4.title }}</a> + </li> + {% if h4.children %} + <ul> + {% for h5 in h4.children %} + <li> + <a href="{{ h5.permalink | safe }}">{{ h5.title }}</a> + {% if h5.children %} + <ul> + {% for h6 in h5.children %} + <li> + <a href="{{ h5.permalink | safe }}">{{ h6.title }}</a> + </li> + {% endfor %} + </ul> + {% endif %} + </li> + {% endfor %} + </ul> + {% endif %} + {% endfor %} + </ul> + {% endif %} + </li> + {% endfor %} + </ul> + {% endif %} + {% endfor %} + </ul> + {% endif %} + </li> + {% endfor %} + </ul> + </nav> + {% endif %} +{% endmacro %} |