zola-sam/templates/macros.html

43 lines
1.5 KiB
HTML
Raw Normal View History

2020-06-10 19:36:40 +02:00
{% macro title_or_last(component, offset=2) %}
{% set length = component.components | length %}
{% set name = component.components | slice(end=length - offset) | last %}
{{ component.title | default(value=name) }}
{% endmacro title_or_last %}
{% macro format_date(date) %}
{% set date_format = config.extra.date_format | default(value="%a %b %e, %Y") %}
{{ date | date(format=date_format) }}
{% endmacro format_date %}
{% macro bottom_menu() %}
<div class="section bottom-menu">
<hr/>
<p>
{% if config.extra.sam_menu and config.extra.sam_bottom_menu %}
{% for link in config.extra.sam_menu %}
<a href="{{ link.link }}">{{ link.text }}</a>
&#183;
{% endfor %}
{% elif config.extra.sam_bottom_menu %}
{% set index = get_section(path="_index.md") %}
{% for current in index.subsections %}
{% set current = get_section(path=current) %}
<a href="{{ current.permalink }}">{{ macros::title_or_last(component=current) }}</a>
&#183;
{% endfor %}
{% endif %}
<a href="{{ config.base_url }}">
{{ config.extra.home | default(value="home") }}
</a>
</p>
</div>
{% endmacro bottom_menu %}
{% macro footer() %}
{% if config.extra.sam_footer %}
<div class="section footer">
{{ config.extra.sam_footer.text | safe }}
</div>
{% endif %}
{% endmacro footer %}