diff --git a/cdhweb/context_processors.py b/cdhweb/context_processors.py index 2d7a6acf..29bdc1c4 100644 --- a/cdhweb/context_processors.py +++ b/cdhweb/context_processors.py @@ -1,4 +1,5 @@ from django.conf import settings +from django.templatetags.static import static from wagtail.models import Site from cdhweb.pages.utils import absolutize_url @@ -14,14 +15,15 @@ def template_settings(request): if "purple-mode" in feature_flags: default_preview_img = "img/alt-modes/purple/cdhlogo_square.png" else: - default_preview_img = "img/cdhlogo_square.jpg" + default_preview_img = "images/cdhlogo_square.jpg" context_extras = { "SHOW_TEST_WARNING": getattr(settings, "SHOW_TEST_WARNING", False), "site": Site.find_for_request(request), - "default_preview_image": absolutize_url( - "".join([settings.STATIC_URL, default_preview_img]) + "default_preview_image": request.build_absolute_uri( + static(default_preview_img) ), + # try using template tag import static tag and use here instead of join django utils static # Include analytics based on settings.DEBUG or override in settings.py # Defaults to opposite of settings.DEBUG "INCLUDE_ANALYTICS": getattr(settings, "INCLUDE_ANALYTICS", not settings.DEBUG), diff --git a/static/images/alt-modes/purple/cdhlogo_square.png b/static/images/alt-modes/purple/cdhlogo_square.png new file mode 100644 index 00000000..5d855c85 Binary files /dev/null and b/static/images/alt-modes/purple/cdhlogo_square.png differ diff --git a/static/images/cdhlogo_square.jpg b/static/images/cdhlogo_square.jpg new file mode 100644 index 00000000..7ae22534 Binary files /dev/null and b/static/images/cdhlogo_square.jpg differ diff --git a/templates/base.html b/templates/base.html index 5b7aec9d..8f2c207c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,9 +5,12 @@ - {% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}{% endblock %}{% block title_suffix %}{% endblock %} - + + {% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}{% endblock %}{% block title_suffix %}{% endblock %} + + {% include "includes/favicons.html" %} + {% include "snippets/head_meta.html" %} @@ -16,22 +19,12 @@ document.documentElement.classList.add('js'); - {% include "includes/favicons.html" %} - - {% comment %} - {% include "core/includes/meta/twitter_card.html" %} - {% include "core/includes/meta/open_graph.html" %} - - {% block og_images %} - {% include "core/includes/meta/open_graph_image.html" %} - {% endblock %} - - {% endcomment %} {% block extra_css %} {# Needed for specific cases #} {% endblock %} - + + diff --git a/templates/snippets/head_meta.html b/templates/snippets/head_meta.html index e9ebda1e..694268e2 100644 --- a/templates/snippets/head_meta.html +++ b/templates/snippets/head_meta.html @@ -7,7 +7,7 @@ {% autoescape on %} {# html metadata #} {% if page.tags.exists %}{% endif %} -{% if meta_description %}{% endif %} + {# determine preview image: specified by page, cdh icon based on url, or default image #} {# open graph metadata #}