feat(series): add navigation

Navigation is similar to the one for all articles but is limited to those of the series.
This commit is contained in:
ZzMzaw 2024-10-05 08:09:18 +02:00
parent 71a2409640
commit 8c31aca81f
10 changed files with 25 additions and 3 deletions

View file

@ -186,14 +186,20 @@ serve_local_mermaid = true
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy # Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
show_previous_next_article_links = false show_previous_next_article_links = false
# Show links to previous and next series articles at the bottom of posts which is part of a series.
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
show_previous_next_series_article_links = false
# Invert order of the links to previous and next articles at the bottom of posts. # Invert order of the links to previous and next articles at the bottom of posts.
# By default, next articles are on the left side of the page and previous articles are on the right side. # By default, next articles are on the left side of the page and previous articles are on the right side.
# To reverse the order (next articles on the right and previous articles on the left), set it to true. # To reverse the order (next articles on the right and previous articles on the left), set it to true.
# This applies to series articles navigation as well.
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy # Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
invert_previous_next_article_links = false invert_previous_next_article_links = false
# Whether the navigation for previous/next article should match the full width of the site (same as the navigation bar at the top) or the article width. # Whether the navigation for previous/next article should match the full width of the site (same as the navigation bar at the top) or the article width.
# To match the navigation bar at the top, set it to true. # To match the navigation bar at the top, set it to true.
# This applies to series articles navigation as well.
previous_next_article_links_full_width = true previous_next_article_links_full_width = true
# Quick navigation buttons. # Quick navigation buttons.

View file

@ -8,4 +8,5 @@ insert_anchor_links = "left"
[extra] [extra]
social_media_card = "blog/social_cards/ca_blog.jpg" social_media_card = "blog/social_cards/ca_blog.jpg"
show_previous_next_article_links = true show_previous_next_article_links = true
show_previous_next_series_article_links = true
+++ +++

View file

@ -8,4 +8,5 @@ insert_anchor_links = "left"
[extra] [extra]
social_media_card = "blog/social_cards/es_blog.jpg" social_media_card = "blog/social_cards/es_blog.jpg"
show_previous_next_article_links = true show_previous_next_article_links = true
show_previous_next_series_article_links = true
+++ +++

View file

@ -8,4 +8,5 @@ insert_anchor_links = "left"
[extra] [extra]
social_media_card = "blog/social_cards/blog.jpg" social_media_card = "blog/social_cards/blog.jpg"
show_previous_next_article_links = true show_previous_next_article_links = true
show_previous_next_series_article_links = true
+++ +++

View file

@ -28,6 +28,8 @@ one_posts = "$NUMBER post"
many_posts = "$NUMBER posts" # "3 posts" many_posts = "$NUMBER posts" # "3 posts"
prev = "Prev" # As in "Previous" page. prev = "Prev" # As in "Previous" page.
next = "Next" # As in "Next" page. next = "Next" # As in "Next" page.
prev_series = "Prev (series)" # As in "Previous" page but within a series.
next_series = "Next (series)" # As in "Next" page but within a series.
of = "of" # E.g. Page 1 "of" 3 of = "of" # E.g. Page 1 "of" 3
all_posts = "All posts" all_posts = "All posts"
all_tags = "All tags" all_tags = "All tags"

View file

@ -28,6 +28,8 @@ one_posts = "$NUMBER article"
many_posts = "$NUMBER articles" many_posts = "$NUMBER articles"
prev = "Précédent" # As in "Previous" page. prev = "Précédent" # As in "Previous" page.
next = "Suivant" # As in "Next" page. next = "Suivant" # As in "Next" page.
prev_series = "Précédent (série)" # As in "Previous" page but within a series.
next_series = "Suivant (série)" # As in "Next" page but within a series.
of = "sur" # E.g. Page 1 "of" 3 of = "sur" # E.g. Page 1 "of" 3
all_posts = "Tous les articles" all_posts = "Tous les articles"
all_tags = "Toutes les étiquettes" all_tags = "Toutes les étiquettes"

View file

@ -200,7 +200,7 @@ details summary {
} }
} }
.article-navigation { .article-navigation, .series-article-navigation {
display: flex; display: flex;
margin-block-start: 2rem; margin-block-start: 2rem;
border-block-start: var(--divider-color) solid 0.5px; border-block-start: var(--divider-color) solid 0.5px;

View file

@ -117,8 +117,8 @@ Parameters:
{% macro get_navigation(page, series_section, series_ordered_pages, language_strings) %} {% macro get_navigation(page, series_section, series_ordered_pages, language_strings) %}
{%- if macros_settings::evaluate_setting_priority(setting="show_previous_next_series_article_links", page=page, default_global_value=false) == "true" -%} {%- if macros_settings::evaluate_setting_priority(setting="show_previous_next_series_article_links", page=page, default_global_value=false) == "true" -%}
{%- if series_ordered_pages | length > 1 -%} {%- if series_ordered_pages | length > 1 -%}
{% set next_series_label = macros_translate::translate(key="next", default="Next", language_strings=language_strings) %} {% set next_series_label = macros_translate::translate(key="next_series", default="Next (series)", language_strings=language_strings) %}
{% set prev_series_label = macros_translate::translate(key="prev", default="Prev", language_strings=language_strings) %} {% set prev_series_label = macros_translate::translate(key="prev_series", default="Prev (series)", language_strings=language_strings) %}
{% set is_previous = true %} {% set is_previous = true %}
{% set is_next = false %} {% set is_next = false %}
{%- for series_page in series_ordered_pages -%} {%- for series_page in series_ordered_pages -%}

View file

@ -250,6 +250,9 @@ Current section extra: {% if current_section %}{{ current_section.extra | json_e
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if series_section %}
{{ macros_series_page::get_navigation(page=page, series_section=series_section, series_ordered_pages=series_ordered_pages, language_strings=language_strings)}}
{%- endif -%}
{% if macros_settings::evaluate_setting_priority(setting="show_previous_next_article_links", page=page, default_global_value=true) == "true" %} {% if macros_settings::evaluate_setting_priority(setting="show_previous_next_article_links", page=page, default_global_value=true) == "true" %}
{%- if page.lower or page.higher -%} {%- if page.lower or page.higher -%}
{% set next_label = macros_translate::translate(key="next", default="Next", language_strings=language_strings) %} {% set next_label = macros_translate::translate(key="next", default="Next", language_strings=language_strings) %}

View file

@ -143,14 +143,20 @@ serve_local_mermaid = true
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy # Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
show_previous_next_article_links = false show_previous_next_article_links = false
# Show links to previous and next series articles at the bottom of posts which is part of a series.
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
show_previous_next_series_article_links = false
# Invert order of the links to previous and next articles at the bottom of posts. # Invert order of the links to previous and next articles at the bottom of posts.
# By default, next articles are on the left side of the page and previous articles are on the right side. # By default, next articles are on the left side of the page and previous articles are on the right side.
# To reverse the order (next articles on the right and previous articles on the left), set it to true. # To reverse the order (next articles on the right and previous articles on the left), set it to true.
# This applies to series articles navigation as well.
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy # Can be set at page or section levels, following the hierarchy: page > section > config. See: https://welpo.github.io/tabi/blog/mastering-tabi-settings/#settings-hierarchy
invert_previous_next_article_links = false invert_previous_next_article_links = false
# Whether the navigation for previous/next article should match the full width of the site (same as the navigation bar at the top) or the article width. # Whether the navigation for previous/next article should match the full width of the site (same as the navigation bar at the top) or the article width.
# To match the navigation bar at the top, set it to true. # To match the navigation bar at the top, set it to true.
# This applies to series articles navigation as well.
previous_next_article_links_full_width = true previous_next_article_links_full_width = true
# Quick navigation buttons. # Quick navigation buttons.