diff options
-rw-r--r-- | config.toml | 2 | ||||
-rw-r--r-- | templates/authors/single.html | 5 | ||||
-rw-r--r-- | templates/base.html | 26 | ||||
-rw-r--r-- | templates/page.html | 9 | ||||
-rw-r--r-- | templates/tags/single.html | 5 |
5 files changed, 44 insertions, 3 deletions
diff --git a/config.toml b/config.toml index 7efbb00..5731f5b 100644 --- a/config.toml +++ b/config.toml @@ -1,5 +1,5 @@ # The URL the site will be built for -base_url = "/rabalder" +base_url = "https://volse.net/rabalder" title = "Rabalder" description = "En blogg om samfunn, teknologi, internett, overvåkning og annet grums." 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> |