Add basic opengraph support

This commit is contained in:
Evie Viau-Chow-Stuart 2023-02-08 01:45:31 -08:00
parent 116024a52d
commit c669c306e6
Signed by: evie
GPG key ID: 928652CDFCEC8099
5 changed files with 52 additions and 6 deletions

View file

@ -1,11 +1,13 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{ settings.site_name }} - {% block title %}{{ title }}{% endblock %}</title>
<meta name="description" content="{% block description %} {% endblock %}" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>{{ settings.site_name }} - {% block title %}{% endblock %}</title>
<meta name="description" content="{% block description %}{% endblock %}" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{% block opengraph %}{% endblock %}
<meta property="og:site_name" content="{{ settings.site_name }}" />
{% match settings.site_additional_head %}
{% when Some with (site_additional_head) %}
{{ site_additional_head|safe }}

View file

@ -2,6 +2,18 @@
{% block title %}{{ title }}{% endblock %}
{% block opengraph %}
<meta property="og:type" content="website" />
<meta property="og:title" content="{{ title }}" />
{% match description %}
{% when Some with (description_content) %}
<meta property="og:description" content="{{ description_content }}" />
{% when None %}
<meta property="og:description" content="A page on {{ settings.site_name }}" />
{% endmatch %}
{% endblock %}
{% block description %}
{% match description %}
{% when Some with (description_content) %}

View file

@ -2,6 +2,32 @@
{% block title %}{{ title }}{% endblock %}
{% block opengraph %}
<meta property="og:type" content="article" />
<meta property="og:title" content="{{ title }}" />
{% match featured_image %}
{% when Some with (featured_image) %}
<meta property="og:image" content="{{ featured_image.url }}" />
{% when None %}
{% endmatch %}
{% match summary %}
{% when Some with (summary_content) %}
<meta property="og:description" content="{{ summary_content }}" />
{% when None %}
<meta property="og:description" content="A page on {{ settings.site_name }}" />
{% endmatch %}
<meta property="og:article:published_time" content="{{ publish_date }}" />
{% match last_updated %}
{% when Some with (last_updated_date) %}
<meta property="og:article:modified_time" content="{{ last_updated_date }}" />
{% when None %}
{% endmatch %}
{% endblock %}
{% block description %}
{% match summary %}
{% when Some with (summary_content) %}

View file

@ -2,6 +2,12 @@
{% block title %}Posts{% endblock %}
{% block opengraph %}
<meta property="og:title" content="Posts" />
<meta property="og:type" content="website" />
<meta property="og:description" content="Listing of all posts" />
{% endblock %}
{% block description %}Listing of all posts{% endblock %}
{% block content %}

View file

@ -23,7 +23,7 @@
/>
{% match image.description %}
{% when Some with (image_description) %}
<p class="image">{{ image_description }}</p>
<i class="image">{{ image_description }}</i>
{% when None %}
{% endmatch %}
</div>