From 73bc9aac05bd75ecffb2693ff41daface3ec0c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABva=20Brunelles?= Date: Wed, 21 Apr 2021 22:51:01 +0200 Subject: [PATCH 01/10] Add support for SEO Pelican plugin --- README.md | 1 + templates/base.html | 27 +++++++++------- templates/partial/jsonld_article.html | 46 ++++++++++++++------------- templates/partial/og.html | 28 ++++++++-------- templates/partial/og_article.html | 46 ++++++++++++++------------- 5 files changed, 79 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 1e73af9..5e740f4 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ The minimalist [Pelican](http://blog.getpelican.com/) theme. - [Representative image](https://github.com/getpelican/pelican-plugins/tree/master/representative_image) - [Neighbors](https://github.com/getpelican/pelican-plugins/tree/master/neighbors) - [Tipue Search](https://github.com/getpelican/pelican-plugins/blob/master/tipue_search/) +- [SEO](https://github.com/pelican-plugins/seo) ## Install diff --git a/templates/base.html b/templates/base.html index 0da863e..ca0cadf 100644 --- a/templates/base.html +++ b/templates/base.html @@ -114,19 +114,22 @@ {% endif %} - {% if REL_CANONICAL %} - {% if page %} - - {% elif article %} - - {% elif page_name == 'index' and not articles_previous_page %} - - {% elif author or category or tag or page_name == 'index' %} - - {% else %} - + {% if not PLUGINS or 'seo' not in PLUGINS %} + {% if REL_CANONICAL %} + {% if page %} + + {% elif article %} + + {% elif page_name == 'index' and not articles_previous_page %} + + {% elif author or category or tag or page_name == 'index' %} + + {% else %} + + {% endif %} {% endif %} - {% endif %} + {% endif %} + {% block meta %} diff --git a/templates/partial/jsonld_article.html b/templates/partial/jsonld_article.html index f0cd70e..abcc32b 100644 --- a/templates/partial/jsonld_article.html +++ b/templates/partial/jsonld_article.html @@ -1,23 +1,25 @@ -{% if SITELOGO %} - {% set default_cover = SITELOGO %} -{% else %} - {% set default_cover = '{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/profile.png' %} +{% if not PLUGINS or 'seo' not in PLUGINS %} + {% if SITELOGO %} + {% set default_cover = SITELOGO %} + {% else %} + {% set default_cover = '{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/profile.png' %} + {% endif %} + {% endif %} - diff --git a/templates/partial/og.html b/templates/partial/og.html index 41e0c8c..7195851 100644 --- a/templates/partial/og.html +++ b/templates/partial/og.html @@ -1,14 +1,16 @@ -{% if OG_LOCALE %} - {% set default_locale = OG_LOCALE %} -{% else %} - {% set default_locale = 'en_US' %} -{% endif %} - - - - - - -{% if SITELOGO %} - +{% if not PLUGINS or 'seo' not in PLUGINS %} + {% if OG_LOCALE %} + {% set default_locale = OG_LOCALE %} + {% else %} + {% set default_locale = 'en_US' %} + {% endif %} + + + + + + + {% if SITELOGO %} + + {% endif %} {% endif %} diff --git a/templates/partial/og_article.html b/templates/partial/og_article.html index 31f70b0..9a929bf 100644 --- a/templates/partial/og_article.html +++ b/templates/partial/og_article.html @@ -1,23 +1,25 @@ -{% if OG_LOCALE %} - {% set default_locale = OG_LOCALE %} -{% else %} - {% set default_locale = 'en_US' %} -{% endif %} - - - - - - - - - - -{% for tag in article.tags %} - -{% endfor %} -{% if 'cover' in article.metadata %} - -{% else %} - +{% if not PLUGINS or 'seo' not in PLUGINS %} + {% if OG_LOCALE %} + {% set default_locale = OG_LOCALE %} + {% else %} + {% set default_locale = 'en_US' %} + {% endif %} + + + + + + + + + + + {% for tag in article.tags %} + + {% endfor %} + {% if 'cover' in article.metadata %} + + {% else %} + + {% endif %} {% endif %} From ab34ff9fe34124f3526afafb31d1ac98709c19a1 Mon Sep 17 00:00:00 2001 From: fy Date: Sun, 13 Jun 2021 16:49:15 +0800 Subject: [PATCH 02/10] add trailing slash for SITEURL. Reason: https://github.com/getpelican/pelican/issues/1156 https://github.com/arulrajnet/attila/pull/4 --- templates/base.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/base.html b/templates/base.html index 0da863e..112b052 100644 --- a/templates/base.html +++ b/templates/base.html @@ -120,7 +120,7 @@ {% elif article %} {% elif page_name == 'index' and not articles_previous_page %} - + {% elif author or category or tag or page_name == 'index' %} {% else %} @@ -157,7 +157,7 @@ {% endif %}