Ensure random redirects aren't indexed
Still allow them to be followed
This commit is contained in:
parent
54aaca3087
commit
43503921db
1 changed files with 4 additions and 2 deletions
|
@ -299,8 +299,10 @@ class BaseListingPage(RoutablePageMixin, BaseContentPage):
|
|||
def random(self, request: HttpRequest) -> HttpResponse:
|
||||
page = self.get_listing_pages().order_by("?").first()
|
||||
if page is None:
|
||||
return redirect(self.get_url(request=request), permanent=False)
|
||||
return redirect(page.get_url(request=request), permanent=False)
|
||||
response = redirect(self.get_url(request=request), permanent=False)
|
||||
response = redirect(page.get_url(request=request), permanent=False)
|
||||
response.headers["X-Robots-Tag"] = "noindex"
|
||||
return response
|
||||
|
||||
|
||||
class ListingPage(BaseListingPage):
|
||||
|
|
Loading…
Reference in a new issue