mirror of
https://github.com/welpo/tabi.git
synced 2026-05-14 10:07:34 +02:00
✨ 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:
parent
e241601f7c
commit
2e75ac7b74
3 changed files with 15 additions and 7 deletions
|
|
@ -222,8 +222,11 @@ favicon = "img/seedling.png"
|
||||||
# Compatibility: https://caniuse.com/link-icon-svg
|
# Compatibility: https://caniuse.com/link-icon-svg
|
||||||
favicon_emoji = "🌱"
|
favicon_emoji = "🌱"
|
||||||
|
|
||||||
# This header image is used for SEO. For example if you were to share an image via Messenger/Instagram/Twitter a preview picture is also presented
|
# Path to the fallback image for social media cards (the image shown when sharing a link on WhatsApp, LinkedIn…).
|
||||||
headerImage = ""
|
# Read more: https://nikitahl.com/html-meta-tags-for-social-media
|
||||||
|
# Using an image representative of each post is recommended. You can do so by setting this variable in the [extra] section of a post's front matter.
|
||||||
|
# If a post doesn't have a social media card, the site's default, below, will be used.
|
||||||
|
social_media_card_path = ""
|
||||||
|
|
||||||
menu = [
|
menu = [
|
||||||
{ name = "blog", url = "blog", trailing_slash = true },
|
{ name = "blog", url = "blog", trailing_slash = true },
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,11 @@
|
||||||
<meta property="og:title" content="{{ config.title }}">
|
<meta property="og:title" content="{{ config.title }}">
|
||||||
<meta property="og:type" content="article" />
|
<meta property="og:type" content="article" />
|
||||||
|
|
||||||
{% if config.extra.headerImage %}
|
{# Image for social media sharing #}
|
||||||
<meta property="og:image" content="{{ config.extra.headerImage }}">
|
{%- set social_media_card = macros_settings::evaluate_setting_priority(setting="social_media_card", page=page | default(value=""), default_global_value="") -%}
|
||||||
<meta name="twitter:card" content="{{ config.extra.headerImage }}">
|
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% set current_url = current_url | default(value="/") %}
|
{% set current_url = current_url | default(value="/") %}
|
||||||
|
|
|
||||||
|
|
@ -107,8 +107,11 @@ separator = "•"
|
||||||
# Compatibility: https://caniuse.com/link-icon-svg
|
# Compatibility: https://caniuse.com/link-icon-svg
|
||||||
# favicon_emoji = "🌱"
|
# favicon_emoji = "🌱"
|
||||||
|
|
||||||
# This header image is used for SEO. For example if you were to share an image via Messenger/Instagram/Twitter a preview picture is also presented
|
# Path to the fallback image for social media cards (the image shown when sharing a link on WhatsApp, LinkedIn…).
|
||||||
# headerImage = ""
|
# Read more: https://nikitahl.com/html-meta-tags-for-social-media
|
||||||
|
# Using an image representative of each post is recommended. You can do so by setting this variable in the [extra] section of a post's front matter.
|
||||||
|
# If a post doesn't have a social media card, the site's default, below, will be used.
|
||||||
|
# social_media_card_path = ""
|
||||||
|
|
||||||
menu = [
|
menu = [
|
||||||
{ name = "blog", url = "blog", trailing_slash = true },
|
{ name = "blog", url = "blog", trailing_slash = true },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue