Don't use page if there isn't one

This commit is contained in:
Jake Howard 2024-05-30 13:47:13 +01:00
parent 36211e88f2
commit d199c3a681
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -298,6 +298,7 @@ class BaseListingPage(RoutablePageMixin, BaseContentPage):
page = self.get_listing_pages().order_by("?").first() page = self.get_listing_pages().order_by("?").first()
if page is None: if page is None:
response = redirect(self.get_url(request=request), permanent=False) response = redirect(self.get_url(request=request), permanent=False)
else:
response = redirect(page.get_url(request=request), permanent=False) response = redirect(page.get_url(request=request), permanent=False)
response.headers["X-Robots-Tag"] = "noindex" response.headers["X-Robots-Tag"] = "noindex"
return response return response