From 5fb0fcd629f936d91439d2ac4491eb32430569de Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 14 Jun 2022 21:53:31 +0100 Subject: [PATCH] Make navbar dynamic This also adds some caching to them for performance reasons --- templates/base.html | 11 ++++++++--- .../common/templates/common}/footer.html | 4 +++- .../common/templates/common}/navbar.html | 18 +++++++++++------- website/common/templatetags/footer_tags.py | 12 ++++++++++++ website/common/templatetags/navbar_tags.py | 19 +++++++++++++++++++ website/settings.py | 3 +++ 6 files changed, 56 insertions(+), 11 deletions(-) rename {templates => website/common/templates/common}/footer.html (67%) rename {templates => website/common/templates/common}/navbar.html (60%) create mode 100644 website/common/templatetags/footer_tags.py create mode 100644 website/common/templatetags/navbar_tags.py diff --git a/templates/base.html b/templates/base.html index d0bd299..282a55a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,4 +1,4 @@ -{% load static wagtailcore_tags wagtailuserbar %} +{% load static wagtailcore_tags wagtailuserbar navbar_tags footer_tags cache %} @@ -23,13 +23,18 @@ {% wagtailuserbar %} - {% include "navbar.html" %} + {% cache 3600 "navbar" page %} + {% navbar page %} + {% endcache %}
{% block content %}{% endblock %}
- {% include "footer.html" %} + {% cache 3600 "footer" %} + {% footer %} + {% endcache %} + diff --git a/templates/footer.html b/website/common/templates/common/footer.html similarity index 67% rename from templates/footer.html rename to website/common/templates/common/footer.html index 413b10c..7b0f885 100644 --- a/templates/footer.html +++ b/website/common/templates/common/footer.html @@ -1,7 +1,9 @@ +{% load wagtailcore_tags %} +