From 7d6dba6a4ec2694eabf0043c0b80614fface5520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Iranzo=20G=C3=B3mez?= Date: Mon, 20 Jan 2020 18:53:21 +0100 Subject: [PATCH] (feat): SEO: Add frontpage meta keywords tags based on all articles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Iranzo Gómez --- THANKS.md | 1 + templates/_includes/smo_metadata.html | 6 +++--- templates/article.html | 3 --- templates/base.html | 3 +++ templates/index.html | 13 +++---------- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/THANKS.md b/THANKS.md index f758b2bcb..771d9b662 100644 --- a/THANKS.md +++ b/THANKS.md @@ -30,6 +30,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d + This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/templates/_includes/smo_metadata.html b/templates/_includes/smo_metadata.html index 927f0e47f..64932e9f9 100644 --- a/templates/_includes/smo_metadata.html +++ b/templates/_includes/smo_metadata.html @@ -1,4 +1,4 @@ -{% macro smo_metadata(article) %} +{% if article %} @@ -12,7 +12,8 @@ {% endif %} -{% if article.featured_image %} +{% endif %} +{% if article and article.featured_image %} {% else %} @@ -22,4 +23,3 @@ {% endif %} {% endif %} -{% endmacro %} diff --git a/templates/article.html b/templates/article.html index 372f8295f..a166c3a20 100644 --- a/templates/article.html +++ b/templates/article.html @@ -18,9 +18,6 @@ {% if article.tags or article.category or article.keywords %} {% endif %} - -{% from '_includes/smo_metadata.html' import smo_metadata with context %} -{{ smo_metadata(article) }} {% endblock meta_tags_in_head %} {% block head_links %} diff --git a/templates/base.html b/templates/base.html index 4b81c2d1f..d68961cb8 100644 --- a/templates/base.html +++ b/templates/base.html @@ -21,9 +21,12 @@ {% endif %} + {% include '_includes/smo_metadata.html' with context %} + {% from '_includes/_defaults.html' import SITE_DESCRIPTION with context %} {% if SITE_DESCRIPTION %} + {% endif %} {% block meta_tags_in_head %} {% from '_includes/_defaults.html' import TWITTER_USERNAME with context %} diff --git a/templates/index.html b/templates/index.html index 316d52569..d8170182c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -15,18 +15,11 @@ {% endif %} -{% from '_includes/_defaults.html' import SITE_DESCRIPTION with context %} -{% if SITE_DESCRIPTION %} - - -{% endif %} -{% from '_includes/_defaults.html' import FEATURED_IMAGE with context %} -{% if FEATURED_IMAGE %} - - -{% endif %} + + + {% endblock meta_tags_in_head %} {% block content %}