diff --git a/sass/main.scss b/sass/main.scss index f2b36c7..cb72361 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -196,7 +196,7 @@ article { } .section-title { - display: block; + display: flex; margin: 0; margin-top: -0.15em; color: var(--text-color-high-contrast); diff --git a/sass/parts/_misc.scss b/sass/parts/_misc.scss index 0580780..d798ddd 100644 --- a/sass/parts/_misc.scss +++ b/sass/parts/_misc.scss @@ -48,6 +48,9 @@ ul { .title-container { padding-bottom: 8px; + .social { + margin-inline-start: 0.5rem; + } } .bottom-divider { diff --git a/templates/base.html b/templates/base.html index 6933a48..20eafa7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,12 +1,13 @@ +{% import "macros/feed_utils.html" as feed_utils %} {% import "macros/format_date.html" as macros_format_date %} {% import "macros/list_posts.html" as macros_list_posts %} {% import "macros/page_header.html" as macros_page_header %} {% import "macros/rel_attributes.html" as macros_rel_attributes %} +{% import "macros/series_page.html" as macros_series_page %} {% 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 %} {% import "macros/target_attribute.html" as macros_target_attribute %} +{% import "macros/translate.html" as macros_translate %} {# 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/feed_utils.html b/templates/macros/feed_utils.html new file mode 100644 index 0000000..653fcda --- /dev/null +++ b/templates/macros/feed_utils.html @@ -0,0 +1,17 @@ +{#- Feed utility macros -#} + +{#- Zola 0.19.0 uses `generate_feeds`. Prior versions use `generate_feed` -#} +{%- macro get_generate_feed() -%} + {{- config.generate_feeds | default(value=config.generate_feed) -}} +{%- endmacro get_generate_feed -%} + +{%- macro get_feed_url() -%} + {{- config.feed_filenames[0] | default(value=(config.feed_filename)) -}} +{%- endmacro get_feed_url -%} + +{#- Check footer feed icon conditions -#} +{%- macro should_show_footer_feed_icon() -%} + {%- set generate_feed = feed_utils::get_generate_feed() -%} + {%- set feed_url = feed_utils::get_feed_url() -%} + {{- generate_feed and config.extra.feed_icon and feed_url -}} +{%- endmacro should_show_footer_feed_icon -%} diff --git a/templates/macros/page_header.html b/templates/macros/page_header.html index 58a23dc..daa8d02 100644 --- a/templates/macros/page_header.html +++ b/templates/macros/page_header.html @@ -1,5 +1,18 @@ -{% macro page_header(title) %} +{% macro page_header(title, show_feed_icon=false) %} + +{% set rel_attributes = macros_rel_attributes::rel_attributes() | trim %} + + +{%- set blank_target = macros_target_attribute::target_attribute(new_tab=config.markdown.external_links_target_blank) -%} +

- {{ title }} + {{ title -}} + {% if show_feed_icon %} + {%- set feed_url = feed_utils::get_feed_url() -%} + + feed + + {% endif %}

+ {% endmacro page_header %} diff --git a/templates/partials/footer.html b/templates/partials/footer.html index 9e984ed..bbab691 100644 --- a/templates/partials/footer.html +++ b/templates/partials/footer.html @@ -5,10 +5,8 @@ {%- set blank_target = macros_target_attribute::target_attribute(new_tab=config.markdown.external_links_target_blank) -%} {#- Feed icon -#} -{#- Zola 0.19.0 uses `generate_feeds`. Prior versions use `generate_feed` -#} -{%- set generate_feed = config.generate_feeds | default(value=config.generate_feed) -%} -{%- set feed_url = config.feed_filenames[0] | default(value=(config.feed_filename)) -%} -{%- set should_show_feed = generate_feed and config.extra.feed_icon and feed_url -%} +{%- set feed_url = feed_utils::get_feed_url() -%} +{%- set should_show_feed = feed_utils::should_show_footer_feed_icon() -%} {%- set should_show_footer_icons = should_show_feed or config.extra.socials or config.extra.email -%} diff --git a/templates/tags/single.html b/templates/tags/single.html index 29d6158..117744f 100644 --- a/templates/tags/single.html +++ b/templates/tags/single.html @@ -2,7 +2,13 @@ {% block main_content %} -{{ macros_page_header::page_header(title=term.name) }} +{#- Feed icon -#} +{%- set generate_feed = feed_utils::get_generate_feed() -%} +{%- set feed_url = feed_utils::get_feed_url() -%} +{%- set feed_pre_conditions = generate_feed and feed_url and taxonomy.feed -%} +{%- set show_feed_icon = feed_pre_conditions and term.pages | filter(attribute="date") -%} + +{{ macros_page_header::page_header(title=term.name, show_feed_icon=show_feed_icon) }} {% set max = section.extra.max_posts | default(value=999999) %} {{ macros_list_posts::list_posts(posts=term.pages, max=max, language_strings=language_strings) }} diff --git a/templates/taxonomy_single.html b/templates/taxonomy_single.html index bce132a..ee3aa88 100644 --- a/templates/taxonomy_single.html +++ b/templates/taxonomy_single.html @@ -2,7 +2,13 @@ {% block main_content %} -{{ macros_page_header::page_header(title=term.name) }} +{#- Feed icon -#} +{%- set generate_feed = feed_utils::get_generate_feed() -%} +{%- set feed_url = feed_utils::get_feed_url() -%} +{%- set feed_pre_conditions = generate_feed and feed_url and taxonomy.feed -%} +{%- set show_feed_icon = feed_pre_conditions and term.pages | filter(attribute="date") | length > 0 -%} + +{{ macros_page_header::page_header(title=term.name, show_feed_icon=show_feed_icon) }} {% set max = section.extra.max_posts | default(value=999999) %} {{ macros_list_posts::list_posts(posts=term.pages, max=max, language_strings=language_strings) }}