aboutsummaryrefslogtreecommitdiff
path: root/crumbs
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-11-24 14:00:26 +0100
committerKatharina Fey <kookie@spacekookie.de>2019-11-24 21:13:14 +0100
commit1a0fa2ffc38721835a26f05d7887634a80a66c3e (patch)
treebc51a33997d8de51d64598307f6ffb38fc15568b /crumbs
parent7385bdb50fd815060a89a1a2b9fe890d63a58c47 (diff)
Adding metatags to the articles template
Diffstat (limited to 'crumbs')
-rw-r--r--crumbs/static/img/card.pngbin0 -> 33639 bytes
-rw-r--r--crumbs/templates/article.html24
-rw-r--r--crumbs/templates/base.html10
-rw-r--r--crumbs/templates/components/html_head.html31
4 files changed, 46 insertions, 19 deletions
diff --git a/crumbs/static/img/card.png b/crumbs/static/img/card.png
new file mode 100644
index 0000000..9f945a1
--- /dev/null
+++ b/crumbs/static/img/card.png
Binary files differ
diff --git a/crumbs/templates/article.html b/crumbs/templates/article.html
index 0bc69ae..f156bfa 100644
--- a/crumbs/templates/article.html
+++ b/crumbs/templates/article.html
@@ -2,6 +2,30 @@
{% block title %}{{ article.title }} {% endblock title %}
+{% block metatags %}
+{% autoescape true %}
+
+<!-- Primary Meta Tags -->
+<meta name="title" content="{{ article.title }}">
+<meta name="description" content="{{ article.summary | striptags }}">
+
+<!-- Open Graph / Facebook -->
+<meta property="og:type" content="website">
+<meta property="og:url" content="https://spacekookie.de">
+<meta property="og:title" content="{{ article.title }}">
+<meta property="og:description" content="{{ article.summary | striptags }}">
+<meta property="og:image" content="https://spacekookie.de/theme/img/card.png">
+
+<!-- Twitter -->
+<meta property="twitter:card" content="summary_large_image">
+<meta property="twitter:image" content="https://spacekookie.de/theme/img/card.png">
+<meta property="twitter:url" content="https://spacekookie.de">
+<meta property="twitter:title" content="{{ article.title }}">
+<meta property="twitter:description" content="{{ article.summary | striptags }}">
+
+{% endautoescape %}
+{% endblock metatags %}
+
{% block content %}
{% with type='single' %}
{% include "components/card_content.html" %}
diff --git a/crumbs/templates/base.html b/crumbs/templates/base.html
index dd8226d..43eab3a 100644
--- a/crumbs/templates/base.html
+++ b/crumbs/templates/base.html
@@ -1,9 +1,13 @@
<!DOCTYPE html>
<html lang="{{ DEFAULT_LANG }}">
- {% block head %}
- {% endblock head %}
-
+ <head>
+ {% block metatags %}
+ {% endblock %}
+ {% block head %}
+ {% endblock %}
+ </head>
+
{% block body %}
<body>
<div class="container">
diff --git a/crumbs/templates/components/html_head.html b/crumbs/templates/components/html_head.html
index be9b3b4..0082421 100644
--- a/crumbs/templates/components/html_head.html
+++ b/crumbs/templates/components/html_head.html
@@ -1,19 +1,18 @@
-<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>{{ SITENAME }}</title>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>{{ SITENAME }}</title>
- {% if type == 'home' %}
- <link href="{{ SITEURL }}/theme/css/crumbs.css" rel="stylesheet">
- <link href="{{ SITEURL }}/theme/css/cr_title.css" rel="stylesheet"> {# This contains various overrides #}
- <a rel="me" href="https://octodon.social/@spacekookie"></a>
- {% else %}
- <link href="{{ SITEURL }}/theme/css/pygment.css" rel="stylesheet">
- <link href="{{ SITEURL }}/theme/css/crumbs.css" rel="stylesheet">
- {% endif %}
+{% if type == 'home' %}
+<link href="{{ SITEURL }}/theme/css/crumbs.css" rel="stylesheet">
+<link href="{{ SITEURL }}/theme/css/cr_title.css" rel="stylesheet"> {# This contains various overrides #}
+<a rel="me" href="https://octodon.social/@spacekookie"></a>
+{% else %}
+<link href="{{ SITEURL }}/theme/css/pygment.css" rel="stylesheet">
+<link href="{{ SITEURL }}/theme/css/crumbs.css" rel="stylesheet">
+{% endif %}
- <link href="https://fonts.googleapis.com/css?family=Montserrat:400,600" rel="stylesheet">
+<link href="https://fonts.googleapis.com/css?family=Montserrat:400,600" rel="stylesheet">
+
+<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.6/css/all.css">
+<link rel="alternate" type="application/rss+xml" href="{{ SITEURL }}/rss.xml" title="{{ SITENAME }} — Latest Posts" />
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.6/css/all.css">
- <link rel="alternate" type="application/rss+xml" href="{{ SITEURL }}/rss.xml" title="{{ SITENAME }} — Latest Posts" />
-</head>