Extracted F.A.Q. breadcrumbs to a separate template.

Signed-off-by: S. Kozyr <s.trump@gmail.com>
This commit is contained in:
Sergiy Kozyr 2024-02-26 15:17:29 +02:00
parent 27ae95f377
commit ef68fc8aa4
Signed by: strump
GPG key ID: C622E5563CAC205D
3 changed files with 20 additions and 15 deletions

View file

@ -85,11 +85,7 @@
<main>
{% if page.taxonomies and page.taxonomies.faq %}{# Show FAQ breadcrumbs #}
{{ trans(key='faq-menu-title', lang=lang) }}
{% set categories = get_taxonomy(kind='faq', lang=page.lang) | get(key="items") %}
{% for item in categories %}
<a href="{{ item.permalink }}">{{ item.name }}</a>
{% endfor %}
{% include 'faq/faq-breadcrumbs.html' %}
{% endif %}
{% block content %}{% endblock %}
</main>

View file

@ -0,0 +1,18 @@
{# Build breadcrumbs in form:
F.A.Q. Android • Bookmarks • General • iOS • Map • Routing • TTS
If we generate /faq/android/, or /faq/general, or etc page then `term` variable is
available with selected FAQ term.
#}
<p class="faq-breadcrumbs">
<span class="faq-title">{{ trans(key='faq-menu-title', lang=lang) }}</span>
{% set categories = get_taxonomy(kind='faq', lang=lang) | get(key="items") %}
{% for item in categories %}
{% if term and term.name == item.name %} {# Do not show link for current FAQ term #}
<span class="faq-taxonomy">{{ item.name }}</span>
{% else %}
<a href="{{ item.permalink }}" class="faq-taxonomy">{{ item.name }}</a>
{% endif %}
{% endfor %}
</p>

View file

@ -5,16 +5,7 @@
{% endblock %}
{% block content %}
{{ trans(key='faq-menu-title', lang=lang) }}
{% set categories = get_taxonomy(kind='faq', lang=lang) | get(key="items") %}
{% for item in categories %}
{% if term.name == item.name %}
<span>{{ item.name }}</span>
{% else %}
<a href="{{ item.permalink }}">{{ item.name }}</a>
{% endif %}
{% endfor %}
{% include 'faq/faq-breadcrumbs.html' %}
<h2>{{ term.name }} {{ trans(key='faq-questions', lang=lang) }}</h2>
{%- for faq_page in term.pages | sort(attribute="extra.order") -%}
<h3><a href="{{ faq_page.permalink }}">{{ faq_page.title }}</a></h3>