diff --git a/content/blog/series/01-series-introduction/index.md b/content/blog/series/01-series-introduction/index.md new file mode 100644 index 0000000..2aff5d6 --- /dev/null +++ b/content/blog/series/01-series-introduction/index.md @@ -0,0 +1,20 @@ ++++ +title = "An introduction to series" +date = 2023-05-21 +description = "This first article introduces how does series works and how to configure them." + +[taxonomies] +tags = ["showcase", "tutorial"] + +[extra] +series_page_introduction = "link" +series_page_introduction_variables = { position = "first", toto = "TOTO!!! "} + ++++ + +{{ admonition(type="warning", icon="warning", title="IMPORTANT", text="This article has been introduced retroactively to showcase series.") }} + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/content/blog/series/02-series-pages-organization/index.md b/content/blog/series/02-series-pages-organization/index.md new file mode 100644 index 0000000..daa090f --- /dev/null +++ b/content/blog/series/02-series-pages-organization/index.md @@ -0,0 +1,19 @@ ++++ +title = "How to organise a series' pages" +date = 2023-08-29 +description = "This second article focuses on how to organisation the pages of a series." + +[taxonomies] +tags = ["showcase", "tutorial"] + +[extra] +series_page_introduction = "summary" + ++++ + +{{ admonition(type="warning", icon="warning", title="IMPORTANT", text="This article has been introduced retroactively to showcase series.") }} + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/content/blog/series/03-series-cheat-sheet/index.md b/content/blog/series/03-series-cheat-sheet/index.md new file mode 100644 index 0000000..2ee2937 --- /dev/null +++ b/content/blog/series/03-series-cheat-sheet/index.md @@ -0,0 +1,16 @@ ++++ +title = "Series cheat sheet" +date = 2024-08-08 +description = "This last article provides an overview of series and describe all possible parameters." + +[taxonomies] +tags = ["showcase", "tutorial", "FAQ"] + +[extra] +series_page_introduction = "custom" + ++++ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/content/blog/series/_index.md b/content/blog/series/_index.md new file mode 100644 index 0000000..cdf055b --- /dev/null +++ b/content/blog/series/_index.md @@ -0,0 +1,21 @@ ++++ +title = "How to deal with series" +template = "series.html" +sort_by = "slug" + +description = "This series explains how to properly configure a series." + +transparent = true + +[extra] +series = true +quick_navigation_buttons = true +post_listing_index_reversed = false + +series_page_introduction = "none" + ++++ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. +Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/i18n/en.toml b/i18n/en.toml index 06bd6a7..17d9a32 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -66,6 +66,7 @@ load_comments = "Load comments" series = "SERIE" series_jump_to_posts = "Jump to posts" series_posts = "Series' posts:" +series_page_headline = "This article is part of the series: $SERIES_HTML_LINK." # Copy code block button. copied = "Copied!" diff --git a/i18n/fr.toml b/i18n/fr.toml index dd9627b..b1f57b8 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -66,6 +66,7 @@ load_comments = "Afficher les commentaires" series = "SERIE" series_jump_to_posts = "Aller aux articles" series_posts = "Articles de la série :" +series_page_headline = "Cet article fait partie de la série : $SERIES_HTML_LINK." # Copy code block button. copied = "Copié !" diff --git a/sass/parts/_misc.scss b/sass/parts/_misc.scss index 143acff..0acd665 100644 --- a/sass/parts/_misc.scss +++ b/sass/parts/_misc.scss @@ -267,3 +267,28 @@ details summary { [data-force-text-direction="rtl"] * { direction: inherit; } + +.series-page-introduction { + margin-top: 1rem; + margin-bottom: 1rem; + border: 1px solid var(--primary-color); + border-left-width: 0.3rem; + border-radius: 10px; + padding: 1rem; + + p { + margin: 0; + } + + summary::marker { + color: var(--primary-color); + font-size: 1.3rem; + } + + details { + ol { + margin-top: 0; + margin-bottom: 0; + } + } +} diff --git a/templates/base.html b/templates/base.html index 6db8bfd..d3d0cc1 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,6 +5,7 @@ {% import "macros/settings.html" as macros_settings %} {% import "macros/table_of_contents.html" as macros_toc %} {% import "macros/translate.html" as macros_translate %} +{% import "macros/series_page.html" as macros_series_page %} {# Load the internationalisation data for the current language from the .toml files in the user's '/i18n' folder, falling back to the theme's. diff --git a/templates/macros/series_page.html b/templates/macros/series_page.html new file mode 100644 index 0000000..5433b93 --- /dev/null +++ b/templates/macros/series_page.html @@ -0,0 +1,84 @@ +{# +Those macros deal with introduction and navigation for series pages. +Using macros have been prefered over partial inclusion or inline code to make sure series_ordered_pages is forced to be used. +A section's pages natural order is invalid in case of reversed pagination which would lead to invalid series' pages order. +To prevent this, pages are ordered correctly in a separate variable which must be used instead of the series section pages. +#} + +{# +Computes the introduction 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_introduction(page, series_section, series_ordered_pages, language_strings) %} + {%- if "series" in series_section.extra and series_section.extra.series -%} + {%- set allowed_series_page_introduction = ["none", "link", "summary", "custom"] -%} + {%- set series_page_introduction = macros_settings::evaluate_setting_priority(setting="series_page_introduction", page=page, section=series_section, default_global_value="link") -%} + {%- if series_page_introduction not in allowed_series_page_introduction -%} + {{ throw(message="ERROR: Invalid value for series_page_description. Allowed values are 'none', 'link', 'summary' or 'custom' (defaults to 'link').") }} + {%- endif -%} + + {# Prepare variables for substitution #} + {%- set series_title = series_section.title -%} + {%- set series_permalink = series_section.permalink -%} + {%- set series_html_link = '' ~ series_section.title ~ '' -%} + {%- set series_pages_list = [] -%} + {%- set series_pages_number = 0 -%} + {%- set series_page_index = 0 -%} + {%- for series_page in series_ordered_pages -%} + {%- set_global series_pages_number = series_pages_number + 1 -%} + {%- if series_page.relative_path == page.relative_path -%} + {%- set_global series_page_index = series_pages_number -%} + {%- set series_pages_list_item = '
{{ series_page_headline | safe }}
+