diff --git a/templates/macros/settings.html b/templates/macros/settings.html index 60ec24f39..923720431 100644 --- a/templates/macros/settings.html +++ b/templates/macros/settings.html @@ -9,10 +9,12 @@ - default_global_value: The setting's default value. #} -{% macro evaluate_setting_priority(setting, page, default_global_value="") %} +{% macro evaluate_setting_priority(setting, page, section="", default_global_value="") %} -{#- Retrieve last ancestor to determine current section, if applicable -#} -{%- if page -%} +{%- if section -%} + {%- set current_section = section -%} +{%- elif page -%} + {#- Retrieve last ancestor to determine current section, if applicable -#} {%- set last_ancestor = page.ancestors | slice(start=-1) %} {%- set current_section = get_section(path=last_ancestor.0) %} {%- endif -%} diff --git a/templates/partials/header.html b/templates/partials/header.html index eb2eddd90..4b208adc1 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -74,7 +74,7 @@ {# Image for social media sharing #} - {%- set social_media_card = macros_settings::evaluate_setting_priority(setting="social_media_card", page=page | default(value=""), default_global_value="") -%} + {%- set social_media_card = macros_settings::evaluate_setting_priority(setting="social_media_card", page=page | default(value=""), section=section | default(value=""), default_global_value="") -%} {% if social_media_card %}