diff --git a/content/blog/series/01-series-introduction/index.md b/content/blog/series/01-series-introduction/index.md index 47ab5eb..3a1d691 100644 --- a/content/blog/series/01-series-introduction/index.md +++ b/content/blog/series/01-series-introduction/index.md @@ -7,7 +7,6 @@ description = "This first article introduces how does series works and how to co tags = ["showcase", "tutorial"] [extra] -series_page_introduction = "link" series_page_introduction_variables = { position = "first", foo = "FOO!!!"} +++ diff --git a/content/blog/series/02-series-pages-organization/index.md b/content/blog/series/02-series-pages-organization/index.md index 43ff0b5..ebbb153 100644 --- a/content/blog/series/02-series-pages-organization/index.md +++ b/content/blog/series/02-series-pages-organization/index.md @@ -7,7 +7,6 @@ description = "This second article focuses on how to organisation the pages of a tags = ["showcase", "tutorial"] [extra] -series_page_introduction = "summary" series_page_introduction_variables = { position = "second", foo = "FOO FOO!!!"} +++ diff --git a/content/blog/series/03-series-cheat-sheet/index.md b/content/blog/series/03-series-cheat-sheet/index.md index bc96f62..9fb2474 100644 --- a/content/blog/series/03-series-cheat-sheet/index.md +++ b/content/blog/series/03-series-cheat-sheet/index.md @@ -7,7 +7,6 @@ description = "This last article provides an overview of series and describe all tags = ["showcase", "tutorial", "FAQ"] [extra] -series_page_introduction = "custom" series_page_introduction_variables = { position = "third", foo = "FOO FOO FOO!!!"} +++ diff --git a/content/blog/series/_index.md b/content/blog/series/_index.md index 5720bc2..5f6d8af 100644 --- a/content/blog/series/_index.md +++ b/content/blog/series/_index.md @@ -12,11 +12,8 @@ series = true quick_navigation_buttons = true post_listing_index_reversed = false -series_page_introduction = "none" - series_page_introduction_placeholders = ["$POSITION", "$FOO", "$BAR"] -series_page_headline = "This article is the $POSITION of the series '$SERIES_HTML_LINK' ($FOO)" -series_page_description = """ +series_page_introduction = """ You can put whatever you want in a custom description. **All** variable are accessibles, including custom ones. diff --git a/i18n/en.toml b/i18n/en.toml index e6c1d73..c4651ec 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -64,9 +64,6 @@ see_changes = "See changes" table_of_contents = "Table of Contents" load_comments = "Load comments" -# Series. -series_page_headline = "This article is part of the series: $SERIES_HTML_LINK." - # Copy code block button. copied = "Copied!" copy_code_to_clipboard = "Copy code to clipboard" diff --git a/i18n/fr.toml b/i18n/fr.toml index 673c8be..89530b4 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -64,9 +64,6 @@ see_changes = "Voir les modifications" table_of_contents = "Table des matières" load_comments = "Afficher les commentaires" -# Series. -series_page_headline = "Cet article fait partie de la série : $SERIES_HTML_LINK." - # Copy code block button. copied = "Copié !" copy_code_to_clipboard = "Copier le code dans le presse-papier" diff --git a/sass/parts/_misc.scss b/sass/parts/_misc.scss index e3564bb..c922a29 100644 --- a/sass/parts/_misc.scss +++ b/sass/parts/_misc.scss @@ -253,28 +253,3 @@ 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/macros/series_page.html b/templates/macros/series_page.html index f8bc746..6be39fb 100644 --- a/templates/macros/series_page.html +++ b/templates/macros/series_page.html @@ -16,12 +16,6 @@ Parameters: #} {% 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 -%} @@ -50,27 +44,20 @@ Parameters: {%- endif -%} {%- set series_pages_unordered_list = '' -%} - {# Define headline #} - {%- set series_page_headline = macros_translate::translate(key="series_page_headline", default="This article is part of the series: $SERIES_HTML_LINK", language_strings=language_strings) -%} - {%- set series_page_headline = series_section.extra.series_page_headline | default(value=series_page_headline) -%} - {%- set series_page_headline = series_page_headline | replace(from="$SERIES_TITLE", to=series_title) | replace(from="$SERIES_PERMALINK", to=series_permalink) | replace(from="$SERIES_HTML_LINK", to=series_html_link) -%} - {%- set series_page_headline = series_page_headline | replace(from="$SERIES_PAGES_NUMBER", to=series_pages_number) | replace(from="$SERIES_PAGE_INDEX", to=series_page_index) | replace(from="$SERIES_PAGES_OLIST", to=series_pages_ordered_list) | replace(from="$SERIES_PAGES_ULIST", to=series_pages_unordered_list) -%} - - {# Define description #} - {%- set series_page_description = series_section.extra.series_page_description | default(value=series_section.description) -%} - {%- set series_page_description = series_page_description | replace(from="$SERIES_TITLE", to=series_title) | replace(from="$SERIES_PERMALINK", to=series_permalink) | replace(from="$SERIES_HTML_LINK", to=series_html_link) -%} - {%- set series_page_description = series_page_description | replace(from="$SERIES_PAGES_NUMBER", to=series_pages_number) | replace(from="$SERIES_PAGE_INDEX", to=series_page_index) | replace(from="$SERIES_PAGES_OLIST", to=series_pages_ordered_list) | replace(from="$SERIES_PAGES_ULIST", to=series_pages_unordered_list) -%} + {# Define introduction #} + {%- set series_page_introduction = series_section.extra.series_page_introduction | default(value="") -%} + {%- set series_page_introduction = series_page_introduction | replace(from="$SERIES_TITLE", to=series_title) | replace(from="$SERIES_PERMALINK", to=series_permalink) | replace(from="$SERIES_HTML_LINK", to=series_html_link) -%} + {%- set series_page_introduction = series_page_introduction | replace(from="$SERIES_PAGES_NUMBER", to=series_pages_number) | replace(from="$SERIES_PAGE_INDEX", to=series_page_index) | replace(from="$SERIES_PAGES_OLIST", to=series_pages_ordered_list) | replace(from="$SERIES_PAGES_ULIST", to=series_pages_unordered_list) -%} {# Replace introduction custom placeholders #} {%- if series_section.extra.series_page_introduction_placeholders is defined -%} {%- set missing_vars = [] -%} {%- for placeholder in series_section.extra.series_page_introduction_placeholders -%} - {%- if placeholder in series_page_headline or placeholder in series_page_description -%} + {%- if placeholder in series_page_introduction -%} {# Attempt to retrieve the corresponding variable by trimming the $ sign and converting to lowercase #} {%- set var_name = placeholder | replace(from="$", to="") | lower -%} {%- if page.extra.series_page_introduction_variables[var_name] -%} - {%- set_global series_page_headline = series_page_headline | replace(from=placeholder, to=page.extra.series_page_introduction_variables[var_name]) -%} - {%- set_global series_page_description = series_page_description | replace(from=placeholder, to=page.extra.series_page_introduction_variables[var_name]) -%} + {%- set_global series_page_introduction = series_page_introduction | replace(from=placeholder, to=page.extra.series_page_introduction_variables[var_name]) -%} {%- else -%} {# Append the variable name to the list of missing variables #} {% set_global missing_vars = missing_vars | concat(with=var_name) -%} @@ -83,23 +70,9 @@ Parameters: {%- endif -%} {%- endif -%} - {%- if series_page_introduction == "link" -%} + {%- if series_page_introduction | length > 0 -%}
-

{{ series_page_headline | markdown | safe }}

-
- {%- elif series_page_introduction == "summary" -%} -
-
- {{ series_page_headline | markdown | replace(from="

", to="") | safe }}

- {{ series_page_description | markdown | safe }} - -
-
- {%- elif series_page_introduction == "custom" -%} -
- {{ series_page_description | markdown | safe }} + {{ series_page_introduction | markdown | safe }}
{%- endif -%} {%- endif -%}