From f8d3a60e50e68e40449dd69fb6b01d3b10d8481e Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Mon, 9 Feb 2026 12:30:49 +0100 Subject: [PATCH] Add Open Graph and Twitter meta tags --- templates/base.html | 13 +++++++++++++ templates/page.html | 9 +++++++++ templates/section.html | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/templates/base.html b/templates/base.html index ad6c122..9e773a5 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,6 +5,19 @@ {% block title %}{{ config.title }}{% endblock title %} + + + + + + + + + {% block og_extra %}{% endblock og_extra %} + + + + diff --git a/templates/page.html b/templates/page.html index efc4d4a..7942fbc 100644 --- a/templates/page.html +++ b/templates/page.html @@ -4,6 +4,15 @@ {% block description %}{% if page.description %}{{ page.description }}{% else %}{{ config.description }}{% endif %}{% endblock description %} +{% block canonical %}{{ page.permalink }}{% endblock canonical %} +{% block og_title %}{{ page.title }}{% endblock og_title %} +{% block og_description %}{% if page.description %}{{ page.description }}{% else %}{{ config.description }}{% endif %}{% endblock og_description %} +{% block og_url %}{{ page.permalink }}{% endblock og_url %} +{% block og_type %}article{% endblock og_type %} +{% block og_extra %}{% if page.date %}{% endif %}{% endblock og_extra %} +{% block twitter_title %}{{ page.title }}{% endblock twitter_title %} +{% block twitter_description %}{% if page.description %}{{ page.description }}{% else %}{{ config.description }}{% endif %}{% endblock twitter_description %} + {% block content %}
diff --git a/templates/section.html b/templates/section.html index d09a865..bbe5a97 100644 --- a/templates/section.html +++ b/templates/section.html @@ -2,6 +2,15 @@ {% block title %}{{ section.title }} - {{ config.title }}{% endblock title %} +{% block description %}{% if section.description %}{{ section.description }}{% else %}{{ config.description }}{% endif %}{% endblock description %} + +{% block canonical %}{{ section.permalink }}{% endblock canonical %} +{% block og_title %}{{ section.title }} - {{ config.title }}{% endblock og_title %} +{% block og_description %}{% if section.description %}{{ section.description }}{% else %}{{ config.description }}{% endif %}{% endblock og_description %} +{% block og_url %}{{ section.permalink }}{% endblock og_url %} +{% block twitter_title %}{{ section.title }} - {{ config.title }}{% endblock twitter_title %} +{% block twitter_description %}{% if section.description %}{{ section.description }}{% else %}{{ config.description }}{% endif %}{% endblock twitter_description %} + {% block content %}

{{ section.title }}