feat: add support for social media cards

Can be set at the post, section and `config.toml`.
It respects the hierarchy post > section > config. See #128
This commit is contained in:
welpo 2023-09-03 21:22:55 +02:00
parent e241601f7c
commit 2e75ac7b74
No known key found for this signature in database
GPG key ID: A2F978CF4EC1F5A6
3 changed files with 15 additions and 7 deletions

View file

@ -73,9 +73,11 @@
<meta property="og:title" content="{{ config.title }}">
<meta property="og:type" content="article" />
{% if config.extra.headerImage %}
<meta property="og:image" content="{{ config.extra.headerImage }}">
<meta name="twitter:card" content="{{ config.extra.headerImage }}">
{# 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="") -%}
{% if social_media_card %}
<meta property="og:image" content="{{ get_url(path=social_media_card) }}">
<meta name="twitter:card" content="{{ get_url(path=social_media_card) }}">
{% endif %}
{% set current_url = current_url | default(value="/") %}