summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2020-12-26 19:07:29 +0100
committerHarald Eilertsen <haraldei@anduin.net>2020-12-26 19:07:29 +0100
commiteb79cee7ef6bdc4a44aabfce10617a18be2b8d96 (patch)
treedf4d5555c4bd23732ad06c6893c2610855ceb5f5 /templates
parent96762ba965d60bd09493ac19cb06cbd0798e44b0 (diff)
downloadrabalderz-eb79cee7ef6bdc4a44aabfce10617a18be2b8d96.tar.gz
rabalderz-eb79cee7ef6bdc4a44aabfce10617a18be2b8d96.tar.bz2
rabalderz-eb79cee7ef6bdc4a44aabfce10617a18be2b8d96.zip
Add opengraph support.
Diffstat (limited to 'templates')
-rw-r--r--templates/authors/single.html5
-rw-r--r--templates/base.html26
-rw-r--r--templates/page.html9
-rw-r--r--templates/tags/single.html5
4 files changed, 43 insertions, 2 deletions
diff --git a/templates/authors/single.html b/templates/authors/single.html
index f61ac4b..5acc50f 100644
--- a/templates/authors/single.html
+++ b/templates/authors/single.html
@@ -1,4 +1,9 @@
{% extends "base.html" %}
+{% block opengraph %}
+ <meta property="og:title" content="{{ term.name }}">
+ <meta property="og:type" content="profile">
+ <meta property="og:url" content="{{ term.permalink | safe }}">
+{% endblock opengraph %}
{% block content %}
<h1 class="author">{{ trans(key="posts_by", lang=lang) }} {{ term.name }}</h1>
diff --git a/templates/base.html b/templates/base.html
index 78dcb60..69e836a 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -5,8 +5,30 @@
<meta name="viewport" content="width=device-width initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>{% if page.title %}{{ page.title }}{% else %}{{ config.title }}{% endif %}</title>
- <meta name="description" content="{{ trans(key='description', lang=lang) }}">
+ <title>{% if page.title %}{{ page.title }} - {% endif %}{{ config.title }}</title>
+
+ <!-- Open Graph stuff -->
+ {% block opengraph %}
+ <meta name="description" content="{{ page.extra['opengraph']['desc'] | default(value=trans(key='description', lang=lang)) }}">
+ <meta property="og:description" content="{{ page.extra['opengraph']['desc'] | default(value=trans(key='description', lang=lang)) }}">
+ <meta property="og:title" content="{{ page.title | default(value=config.title) }}">
+ <meta property="og:type" content="article">
+ <meta property="og:url" content="{{ page.permalink | default(value=section.permalink | safe) | safe }}">
+ {% if page.extra['opengraph']['img'] %}
+ <meta property="og:image" content="{{ current_url | safe }}{{ page.extra['opengraph']['img'] | safe }}">
+ {% endif %}
+
+ <meta name="twitter:card" content="summary_large_image">
+ <meta property="twitter:domain" content="volse.net">
+ <meta property="twitter:url" content="{{ page.permalink | default(value=section.permalink | safe) | safe }}">
+ <meta property="twitter:title" content="{{ page.title | default(value=config.title) }}">
+ <meta property="twitter:description" content="{{ page.extra['opengraph']['desc'] | default(value=trans(key='description', lang=lang)) }}">
+ {% if page.extra['opengraph']['img'] %}
+ <meta property="twitter:image" content="{{ current_url | safe }}{{ page.extra['opengraph']['img'] | safe }}">
+ {% endif %}
+ {% endblock opengraph %}
+ <meta property="og:site_name" content="{{ config.title }}">
+
<link rel="stylesheet" type="text/css" href="{{ get_url(path='/styles.css') | safe }}">
<link rel="alternate"
diff --git a/templates/page.html b/templates/page.html
index 1ad56a9..809c30c 100644
--- a/templates/page.html
+++ b/templates/page.html
@@ -1,4 +1,13 @@
{% extends "base.html" %}
+
+{% block opengraph %}
+ <meta name="description" content="{{ page.summary | default(value=page.content) | striptags | trim | truncate(length=200) }}">
+ <meta property="og:title" content="{{ page.title }}">
+ <meta property="og:type" content="article">
+ <meta property="og:url" content="{{ page.permalink | safe }}">
+ <meta property="og:description" content="{{ page.summary | default(value=page.content) | striptags | trim | truncate(length=200) }}">
+{% endblock opengraph %}
+
{% block language %}
{% set translations = page.translations %}
{% include "translation-links.html" %}
diff --git a/templates/tags/single.html b/templates/tags/single.html
index ab0364c..63660d0 100644
--- a/templates/tags/single.html
+++ b/templates/tags/single.html
@@ -1,4 +1,9 @@
{% extends "base.html" %}
+{% block opengraph %}
+ <meta property="og:title" content="{{ term.name }}">
+ <meta property="og:type" content="website">
+ <meta property="og:url" content="{{ term.permalink | safe }}">
+{% endblock opengraph %}
{% block content %}
<h1 class="tag">Tag: {{ term.name }}</h1>