diff --git a/network-api/networkapi/wagtailpages/templatetags/blog_tags.py b/network-api/networkapi/wagtailpages/templatetags/blog_tags.py index b96a7ba163d..e9e0a9cc0be 100644 --- a/network-api/networkapi/wagtailpages/templatetags/blog_tags.py +++ b/network-api/networkapi/wagtailpages/templatetags/blog_tags.py @@ -1,4 +1,5 @@ from django import template +from wagtail.models import Locale register = template.Library() @@ -7,10 +8,11 @@ def get_root_or_page(context): root = context.get("root", None) page = context.get("page", None) + locale = Locale.get_active() if root: - return root.specific + return root.get_translation_or_none(locale).specific elif page: - return page.get_parent().specific + return page.get_translation_or_none(locale).get_parent().specific else: print("There is no root or page in templatetag get_root_or_page")