mirror of
https://github.com/welpo/tabi.git
synced 2026-05-14 10:07:34 +02:00
✨ feat: allow social media cards on sections
This commit is contained in:
parent
1584e1ab4b
commit
e965aa45b3
2 changed files with 6 additions and 4 deletions
|
|
@ -9,10 +9,12 @@ Parameters:
|
|||
- 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 -%}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
<meta property="og:type" content="article" />
|
||||
|
||||
{# 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 %}
|
||||
<meta property="og:image" content="{{ get_url(path=social_media_card) }}" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue