From 8c31aca81f2e1ce71841a9fef972a03db8504396 Mon Sep 17 00:00:00 2001 From: ZzMzaw <89450172+ZzMzaw@users.noreply.github.com> Date: Sat, 5 Oct 2024 08:09:18 +0200 Subject: [PATCH] feat(series): add navigation Navigation is similar to the one for all articles but is limited to those of the series. --- config.toml | 6 ++++++ content/blog/_index.ca.md | 1 + content/blog/_index.es.md | 1 + content/blog/_index.md | 1 + i18n/en.toml | 2 ++ i18n/fr.toml | 2 ++ sass/parts/_misc.scss | 2 +- templates/macros/series_page.html | 4 ++-- templates/page.html | 3 +++ theme.toml | 6 ++++++ 10 files changed, 25 insertions(+), 3 deletions(-) diff --git a/config.toml b/config.toml index d89cd70..1e8c087 100644 --- a/config.toml +++ b/config.toml @@ -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 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. # 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. +# 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 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. # 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 # Quick navigation buttons. diff --git a/content/blog/_index.ca.md b/content/blog/_index.ca.md index 7a72231..3ef05bb 100644 --- a/content/blog/_index.ca.md +++ b/content/blog/_index.ca.md @@ -8,4 +8,5 @@ insert_anchor_links = "left" [extra] social_media_card = "blog/social_cards/ca_blog.jpg" show_previous_next_article_links = true +show_previous_next_series_article_links = true +++ diff --git a/content/blog/_index.es.md b/content/blog/_index.es.md index a367dbb..b3d11d7 100644 --- a/content/blog/_index.es.md +++ b/content/blog/_index.es.md @@ -8,4 +8,5 @@ insert_anchor_links = "left" [extra] social_media_card = "blog/social_cards/es_blog.jpg" show_previous_next_article_links = true +show_previous_next_series_article_links = true +++ diff --git a/content/blog/_index.md b/content/blog/_index.md index 036db4d..c12c66a 100644 --- a/content/blog/_index.md +++ b/content/blog/_index.md @@ -8,4 +8,5 @@ insert_anchor_links = "left" [extra] social_media_card = "blog/social_cards/blog.jpg" show_previous_next_article_links = true +show_previous_next_series_article_links = true +++ diff --git a/i18n/en.toml b/i18n/en.toml index 17d9a32..fb30c31 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -28,6 +28,8 @@ one_posts = "$NUMBER post" many_posts = "$NUMBER posts" # "3 posts" prev = "Prev" # As in "Previous" 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 all_posts = "All posts" all_tags = "All tags" diff --git a/i18n/fr.toml b/i18n/fr.toml index b1f57b8..9846ef3 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -28,6 +28,8 @@ one_posts = "$NUMBER article" many_posts = "$NUMBER articles" prev = "Précédent" # As in "Previous" 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 all_posts = "Tous les articles" all_tags = "Toutes les étiquettes" diff --git a/sass/parts/_misc.scss b/sass/parts/_misc.scss index 0acd665..0cfac16 100644 --- a/sass/parts/_misc.scss +++ b/sass/parts/_misc.scss @@ -200,7 +200,7 @@ details summary { } } -.article-navigation { +.article-navigation, .series-article-navigation { display: flex; margin-block-start: 2rem; border-block-start: var(--divider-color) solid 0.5px; diff --git a/templates/macros/series_page.html b/templates/macros/series_page.html index 39fcb11..48c3106 100644 --- a/templates/macros/series_page.html +++ b/templates/macros/series_page.html @@ -117,8 +117,8 @@ Parameters: {% 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 series_ordered_pages | length > 1 -%} - {% set next_series_label = macros_translate::translate(key="next", default="Next", language_strings=language_strings) %} - {% set prev_series_label = macros_translate::translate(key="prev", default="Prev", 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_series", default="Prev (series)", language_strings=language_strings) %} {% set is_previous = true %} {% set is_next = false %} {%- for series_page in series_ordered_pages -%} diff --git a/templates/page.html b/templates/page.html index 9a0c67c..ab68604 100644 --- a/templates/page.html +++ b/templates/page.html @@ -250,6 +250,9 @@ Current section extra: {% if current_section %}{{ current_section.extra | json_e {% endif %} {% 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 page.lower or page.higher -%} {% set next_label = macros_translate::translate(key="next", default="Next", language_strings=language_strings) %} diff --git a/theme.toml b/theme.toml index 51a96d3..cf38da0 100644 --- a/theme.toml +++ b/theme.toml @@ -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 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. # 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. +# 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 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. # 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 # Quick navigation buttons.