{# Sidebar with taxonomy navigation and feeds. #} {%- macro taxonomy_item(item) -%}
  • {{ item.label|e }}{{ item.count }}
  • {%- endmacro -%} {%- macro taxonomy_links(items) -%} {%- endmacro -%} {%- macro taxonomy_section(items, heading, css_class, all_label) -%} {%- if items -%} {%- set ordered = items|sort(attribute='count', reverse=true) -%}

    {{ heading }}

    {{ taxonomy_links(ordered[:5]) }} {%- if ordered|length > 5 -%}
    {{ all_label }} ({{ ordered|length }}) {{ taxonomy_links(ordered[5:]) }}
    {%- endif -%}
    {%- endif -%} {%- endmacro -%}
    {%- set tax = maatlog.taxonomies -%} {{ taxonomy_section(tax.tags, "Tags", "maatlog-taxonomy-tags", "All tags") }} {{ taxonomy_section(tax.categories, "Categories", "maatlog-taxonomy-categories", "All categories") }} {{ taxonomy_section(tax.authors, "Authors", "maatlog-taxonomy-authors", "All authors") }} {%- if tax.months -%} {%- set months = tax.months|sort(attribute='id', reverse=true) -%} {%- set years = [] -%} {%- for item in months -%} {%- if item.id[:4] not in years -%}{%- set _ = years.append(item.id[:4]) -%}{%- endif -%} {%- endfor -%}

    Archives

    {%- for year in years -%}
    {{ year }}
      {%- for item in months if item.id[:4] == year -%}{{ taxonomy_item(item) }}{%- endfor -%}
    {%- endfor -%}
    {%- endif -%} {%- include "maatlog/components/feed-links.html" -%}