Remove current page from part of navbar caching

We don't show the currently active page in the nav, so this isn't necessary. This also allows the cache to be shared between pages.
This commit is contained in:
Jake Howard 2022-07-03 23:13:23 +01:00
parent 4702afd5dd
commit 51be747103
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 3 additions and 5 deletions

View file

@ -23,8 +23,8 @@
<body class="{% block body_class %}{% endblock %}">
{% wagtailuserbar %}
{% cache 3600 "navbar" page %}
{% navbar page %}
{% cache 3600 "navbar" %}
{% navbar %}
{% endcache %}
{% block main %}

View file

@ -1,5 +1,4 @@
from django.template import Library
from wagtail.models import Page
from website.home.models import HomePage
@ -7,10 +6,9 @@ register = Library()
@register.inclusion_tag("common/navbar.html")
def navbar(current_page: Page) -> dict:
def navbar() -> dict:
homepage = HomePage.objects.live().get()
return {
"current_page": current_page,
"homepage": homepage,
"nav_pages": homepage.get_children()
.live()