Return footer links, with a bit different style

This commit is contained in:
daudix
2024-06-18 04:02:32 +03:00
parent 52e9cbeda0
commit dce877ff85
4 changed files with 81 additions and 19 deletions

View File

@ -1,4 +1,38 @@
{% set current_lang = config.default_language %}
{% if page %}
{% set current_lang = page.lang %}
{% elif section %}
{%- set current_lang = section.lang %}
{% endif %}
<footer id="site-footer">
{% if config.extra.footer.links %}
<nav>
<ul>
{% for link in config.extra.footer.links %}
{% if current_lang == config.default_language %}
{% set title = link.name %}
{% else %}
{% set language_key = 'name_' ~ current_lang %}
{% set title = link[language_key] %}
{% endif %}
{%- if link.url is matching('https?://') %}
<li>
<a href="{{ link.url }}">
{{ title }}
</a>
</li>
{%- else %}
<li>
<a href="{{ get_url(path=link.url, lang=lang)}}">
{{ title }}
</a>
</li>
{%- endif %}
{% endfor %}
</ul>
</nav>
{% endif %}
{% if config.extra.footer.show_copyright %}
<p title="Last built at {{ now() | date(format='%F %a %R') }}">
&copy; {{ config.title }}, {{ now() | date(format="%Y") }}

View File

@ -25,7 +25,7 @@
{% set title = link[language_key] %}
{% endif %}
{%- if link.url is matching('https?://') %}
<li class="link">
<li>
<a href="{{ link.url }}"
{% if current_url | default(value='/') | trim_end_matches(pat='/') | safe == link.url | trim_end_matches(pat='/') | safe %}
class="active"
@ -34,7 +34,7 @@
</a>
</li>
{%- else %}
<li class="link">
<li>
<a href="{{ get_url(path=link.url, lang=lang)}}"
{% if current_url | default(value='/') | trim_end_matches(pat='/') | safe == get_url(path=link.url, lang=lang) | trim_end_matches(pat='/') | safe %}
class="active"