feat(footer): add configurable copyright notice

- The text `$CURRENT_YEAR` will be replaced by the current year.

- Can be translated.

- Markdown is rendered.
This commit is contained in:
welpo 2023-08-18 23:00:05 +02:00
parent d3167adb8f
commit 6ed13f036e
No known key found for this signature in database
GPG key ID: A2F978CF4EC1F5A6
4 changed files with 54 additions and 12 deletions

View file

@ -50,17 +50,25 @@
{% endif %}
</nav>
<div class="credits">
{# Shows "Powered by Zola & tabi" #}
{# Shows link to remote repository if repository is set and `show_remote_source` is not false #}
{% set show_source = config.extra.show_remote_source | default(value=true) %}
<small>
{# Shows optional Copyright notice #}
{%- if config.extra.copyright -%}
{% set current_year = now() | date(format="%Y") %}
{# Translate the copyright if set in the config #}
{%- if config.extra.translate_copyright and lang != config.default_language -%}
<p>{{ trans(key="copyright", lang=lang) | replace(from="$CURRENT_YEAR", to=current_year) | markdown | safe }}</p>
{%- else -%}
<p>{{ config.extra.copyright | replace(from="$CURRENT_YEAR", to=current_year) | markdown | safe }}</p>
{%- endif -%}
{%- endif -%}
{# Shows "Powered by Zola & tabi" notice #}
{%- if lang != config.default_language -%}
{{ trans(key="powered_by" | safe, lang=lang) }}
{%- else -%}
Powered by
{%- endif -%}
&nbsp;<a href="https://www.getzola.org" target="_blank">Zola</a>&nbsp;
{%- if lang != config.default_language -%}
{{ trans(key="and" | safe, lang=lang) }}
{%- else -%}
@ -68,6 +76,8 @@
{%- endif -%}
&nbsp;<a href="https://github.com/welpo/tabi" target="_blank">tabi</a>
{# Shows link to remote repository if repository is set and `show_remote_source` is not false #}
{% set show_source = config.extra.show_remote_source | default(value=true) %}
{%- if config.extra.remote_repository_url and show_source -%}
&nbsp;{{ separator }}
<a href="{{ config.extra.remote_repository_url }}" target="_blank">