From a5a2e0ae482a5168781b4abf952885531bdc93cc Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Sun, 17 Apr 2022 15:34:03 -0700 Subject: make generating seo-related tags optional --- config.toml | 4 ++- templates/404.html | 11 ++++--- templates/base.html | 87 +++++++++++++++++++++++++++++------------------------ 3 files changed, 58 insertions(+), 44 deletions(-) diff --git a/config.toml b/config.toml index 9d985a0..c65cdb3 100644 --- a/config.toml +++ b/config.toml @@ -82,5 +82,7 @@ pinterest = "your-user-name" twitch = "your-user-name" youtube = "your-channel-id" -start_year = 2019 # optional, copyright start year +# seo = true # enable or disable seo-related tags, defaults to true + +# start_year = 2019 # optional, copyright start year # end_year = 2022 #optional, copyright end year, defaults to current year if unset diff --git a/templates/404.html b/templates/404.html index 22e8791..23c7168 100644 --- a/templates/404.html +++ b/templates/404.html @@ -2,10 +2,13 @@ {# Title #} {% block title %}Sorry! Page not found.{% endblock title %} -{% block current_url %} - - -{% endblock current_url %} + +{% if config.extra.seo | default(value=true) %} + {% block current_url %} + + + {% endblock current_url %} +{% endif %} {# Page heading #} {% block content %}
diff --git a/templates/base.html b/templates/base.html index 0e826da..77c4742 100644 --- a/templates/base.html +++ b/templates/base.html @@ -11,12 +11,16 @@ {% block description %} {% if page.description %} + {% if config.extra.seo | default(value=true) %} + {% endif %} {% else %} + {% if config.extra.seo | default(value=true) %} + {% endif %} {% endif %} {% endblock description %} @@ -47,53 +51,58 @@ {% endif %} {% if config.generate_feed %}{% endif %} - {% block ogp_head %} - {% if page.title %} - - - {% else %} - - - {% endif %} + {% if config.extra.seo | default(value=true) %} + {% block ogp_head %} + {% if page.title %} + + + {% else %} + + + {% endif %} - - - - {% endblock ogp_head %} + + + + + {% endblock ogp_head %} - {% block current_url %} - {% endblock current_url %} + {% block current_url %} + + + {% endblock current_url %} - {% if config.extra.social.twitter %} - - - {% endif %} + {% if config.extra.social.twitter %} + + + {% endif %} - {% if page.extra.thumbnail %} - - - - {% elif page.extra.static_thumbnail %} - {%if page.extra.static_thumbnail is matching("^http[s]?://") %} + {% if page.extra.thumbnail %} - - + + + {% elif page.extra.static_thumbnail %} + {%if page.extra.static_thumbnail is matching("^http[s]?://") %} + + + + {% else %} + + + + {% endif %} + {% elif config.extra.default_og_image %} + + + + {% elif config.extra.banner %} + + + {% else %} - - - + {% endif %} - {% elif config.extra.default_og_image %} - - - - {% elif config.extra.banner %} - - - - {% else %} - {% endif %} {% block extra_head %}{% endblock extra_head %} -- cgit v1.3.1