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:
parent
4702afd5dd
commit
51be747103
2 changed files with 3 additions and 5 deletions
|
@ -23,8 +23,8 @@
|
||||||
<body class="{% block body_class %}{% endblock %}">
|
<body class="{% block body_class %}{% endblock %}">
|
||||||
{% wagtailuserbar %}
|
{% wagtailuserbar %}
|
||||||
|
|
||||||
{% cache 3600 "navbar" page %}
|
{% cache 3600 "navbar" %}
|
||||||
{% navbar page %}
|
{% navbar %}
|
||||||
{% endcache %}
|
{% endcache %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from django.template import Library
|
from django.template import Library
|
||||||
from wagtail.models import Page
|
|
||||||
|
|
||||||
from website.home.models import HomePage
|
from website.home.models import HomePage
|
||||||
|
|
||||||
|
@ -7,10 +6,9 @@ register = Library()
|
||||||
|
|
||||||
|
|
||||||
@register.inclusion_tag("common/navbar.html")
|
@register.inclusion_tag("common/navbar.html")
|
||||||
def navbar(current_page: Page) -> dict:
|
def navbar() -> dict:
|
||||||
homepage = HomePage.objects.live().get()
|
homepage = HomePage.objects.live().get()
|
||||||
return {
|
return {
|
||||||
"current_page": current_page,
|
|
||||||
"homepage": homepage,
|
"homepage": homepage,
|
||||||
"nav_pages": homepage.get_children()
|
"nav_pages": homepage.get_children()
|
||||||
.live()
|
.live()
|
||||||
|
|
Loading…
Reference in a new issue