blog/themes/next/layout/_macro/menu/menu-badge.swig
2019-05-30 18:52:14 +08:00

15 lines
305 B
Plaintext

{% macro render(name) %}
{% set badges = {
archives: site.posts.length,
categories: site.categories.length,
tags: site.tags.length }
%}
{% for menu, count in badges %}
{% if name == menu %}
<span class="badge">{{ count }}</span>
{% endif %}
{% endfor %}
{% endmacro %}