From 769d5a373fa6634773165fa7ff9226e8855db706 Mon Sep 17 00:00:00 2001 From: ZzMzaw <89450172+ZzMzaw@users.noreply.github.com> Date: Fri, 26 Jul 2024 07:31:38 +0200 Subject: [PATCH 01/39] refactor(page): put comments code together --- templates/page.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/page.html b/templates/page.html index 969baa0fc..5eda480c1 100644 --- a/templates/page.html +++ b/templates/page.html @@ -219,11 +219,6 @@
{{ series_page_headline | safe }}
+You can put whatever you want in a custom description.
+All variable are accessibles, including custom ones.
+{{ series_page_headline | safe }}
@@ -82,3 +104,77 @@ {%- endif -%} {%- endif -%} {% endmacro %} + +{# +Computes the series navigation of a series's page. + +Parameters: + - `page`: The page object being part of the series. + - `series_section`: The series' section the page belongs to. + - `series_ordered_pages`: The series' pages properly ordered (see at the top of this file for an explanation). + - `language_strings`: A dictionary containing the translation 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 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 is_previous = true %} + {% set is_next = false %} + {%- for series_page in series_ordered_pages -%} + {%- if series_page.relative_path == page.relative_path -%} + {%- set_global is_previous = false -%} + {%- set_global is_next = true -%} + {%- else -%} + {%- if is_previous -%} + {%- set_global prev_series_page = series_page -%} + {%- endif -%} + {%- if is_next -%} + {%- set_global next_series_page = series_page -%} + {%- set_global is_next = false-%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {% if macros_settings::evaluate_setting_priority(setting="invert_previous_next_article_links", page=page, default_global_value=true) == "true" %} + {% if prev_series_page %} + {% set left_series_link = prev_series_page.permalink %} + {% set left_series_label = prev_series_label %} + {% set left_series_title = prev_series_page.title %} + {% endif %} + {% if next_series_page %} + {% set right_series_link = next_series_page.permalink %} + {% set right_series_label = next_series_label %} + {% set right_series_title = next_series_page.title %} + {% endif %} + {% else %} + {% if next_series_page %} + {% set left_series_link = next_series_page.permalink %} + {% set left_series_label = next_series_label %} + {% set left_series_title = next_series_page.title %} + {% endif %} + {% if prev_series_page %} + {% set right_series_link = prev_series_page.permalink %} + {% set right_series_label = prev_series_label %} + {% set right_series_title = prev_series_page.title %} + {% endif %} + {% endif %} + {% if macros_settings::evaluate_setting_priority(setting="previous_next_article_links_full_width", page=page, default_global_value=true) == "true" %} + {%- set full_width_class = "full-width" -%} + {% endif %} + + {%- endif -%} + {%- endif -%} +{% endmacro %} 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 08/39] 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 d89cd70ee..1e8c087b1 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 7a722314c..3ef05bb3b 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 a367dbbad..b3d11d7e6 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 036db4df5..c12c66a7b 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 17d9a3246..fb30c3172 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 b1f57b827..9846ef352 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 0acd66542..0cfac1648 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 39fcb1195..48c31063c 100644 --- a/templates/macros/series_page.html +++ b/templates/macros/series_page.html @@ -117,8 +117,8 @@ {% 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 9a0c67c56..ab686046b 100644 --- a/templates/page.html +++ b/templates/page.html @@ -250,6 +250,9 @@You can put whatever you want in a custom description.
-All variable are accessibles, including custom ones.
-{{ series_page_headline | safe }}
+{{ series_page_headline | markdown | safe }}
", to="") | safe }}
{{ left_series_title | truncate(length=100, end="…") }}
- {%- endif -%} -{{ right_series_title | truncate(length=100, end="…") }}
- {%- endif -%} -46LqCyyhWwxQ4{krAf0q8e<3Gb6>-|B0DgJBzEBl9$pRf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