From c669c306e65575c33e1195b1d78ebab34426c22c Mon Sep 17 00:00:00 2001 From: Evie Viau Date: Wed, 8 Feb 2023 01:45:31 -0800 Subject: [PATCH] Add basic opengraph support --- templates/base.html | 12 +++++++----- templates/page.html | 12 ++++++++++++ templates/post.html | 26 ++++++++++++++++++++++++++ templates/posts_listing.html | 6 ++++++ templates/resolve_content.html | 2 +- 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/templates/base.html b/templates/base.html index 7d24e2b..7e88f30 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,11 +1,13 @@ - - - {{ settings.site_name }} - {% block title %}{{ title }}{% endblock %} - - + + + {{ settings.site_name }} - {% block title %}{% endblock %} + + + {% block opengraph %}{% endblock %} + {% match settings.site_additional_head %} {% when Some with (site_additional_head) %} {{ site_additional_head|safe }} diff --git a/templates/page.html b/templates/page.html index c7c8157..12c1a31 100644 --- a/templates/page.html +++ b/templates/page.html @@ -2,6 +2,18 @@ {% block title %}{{ title }}{% endblock %} +{% block opengraph %} + + + + {% match description %} + {% when Some with (description_content) %} + + {% when None %} + + {% endmatch %} +{% endblock %} + {% block description %} {% match description %} {% when Some with (description_content) %} diff --git a/templates/post.html b/templates/post.html index 76d32f3..be18c8e 100644 --- a/templates/post.html +++ b/templates/post.html @@ -2,6 +2,32 @@ {% block title %}{{ title }}{% endblock %} +{% block opengraph %} + + + + {% match featured_image %} + {% when Some with (featured_image) %} + + {% when None %} + {% endmatch %} + + {% match summary %} + {% when Some with (summary_content) %} + + {% when None %} + + {% endmatch %} + + + + {% match last_updated %} + {% when Some with (last_updated_date) %} + + {% when None %} + {% endmatch %} +{% endblock %} + {% block description %} {% match summary %} {% when Some with (summary_content) %} diff --git a/templates/posts_listing.html b/templates/posts_listing.html index dbbec71..20e2f85 100644 --- a/templates/posts_listing.html +++ b/templates/posts_listing.html @@ -2,6 +2,12 @@ {% block title %}Posts{% endblock %} +{% block opengraph %} + + + +{% endblock %} + {% block description %}Listing of all posts{% endblock %} {% block content %} diff --git a/templates/resolve_content.html b/templates/resolve_content.html index ccc9819..a35464f 100644 --- a/templates/resolve_content.html +++ b/templates/resolve_content.html @@ -23,7 +23,7 @@ /> {% match image.description %} {% when Some with (image_description) %} -

{{ image_description }}

+ {{ image_description }} {% when None %} {% endmatch %}