1
0

List categories in article info

This commit is contained in:
Emil Miler 2021-12-04 18:05:15 +01:00
parent e0ca8f1f2c
commit e20c485d03
3 changed files with 19 additions and 4 deletions

View File

@ -80,6 +80,16 @@ main {
border-top: 1px solid #eee; border-top: 1px solid #eee;
margin: 2em 0; margin: 2em 0;
padding: 1em 0; padding: 1em 0;
ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
font-size: .85em;
li { margin-right: 1em }
}
} }
img { img {
max-width: 100%; max-width: 100%;

View File

@ -16,7 +16,8 @@
<li><a href="{{ item.path }}">{{ item.title }}</a></li> <li><a href="{{ item.path }}">{{ item.title }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{{ macros::list_taxonomy(title="Categories", kind="categories") }} <span class="title">Categories</span>
{{ macros::list_taxonomy(kind="categories") }}
</aside> </aside>
<main> <main>
{% block content %} {% block content %}

View File

@ -23,16 +23,20 @@
{%- if page.extra.author -%} {%- if page.extra.author -%}
, <span class="author">{{ page.extra.author }}</span> , <span class="author">{{ page.extra.author }}</span>
{% endif %} {% endif %}
{% if page.taxonomies.categories %}
<div class="taxonomy">
{{ self::list_taxonomy(kind="categories", prepend="#") }}
</div>
{% endif %}
</div> </div>
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}
{% macro list_taxonomy(title, kind) %} {% macro list_taxonomy(kind, prepend="") %}
<span class="title">{{ title }}</span>
<ul> <ul>
{% set taxonomy = get_taxonomy(kind=kind) %} {% set taxonomy = get_taxonomy(kind=kind) %}
{% for term in taxonomy.items %} {% for term in taxonomy.items %}
<li class="item"><a href="{{ term.permalink | safe }}">{{ term.name }}</a></li> <li class="item"><a href="{{ term.permalink | safe }}">{{prepend}}{{ term.name }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endmacro list_categories %} {% endmacro list_categories %}