I'm attempting to set a page as the root home page of my wagtail based site.
I know you can set the homepage using the sites
setting. But, my use case is different.
I'm using a "redirect" page which redirects to an index page as the homepage. The index is restricted to only allow ertain page types (since it's an index....). But, this causes issues with other pages not being in the tree if it was set at the root.
Hence, the redirect. But, upon redirecting the serve
view of the redirect page to use this page it picks up the slug.
I still want it to appear at the root url. Meaning, /
. How can I achieve this?
High level description:
from django.shortcuts import redirect
class IndexPage(Page):
# children restricted to IndexSubpage
class IndexSubpage(Page):
# parent restricted to IndexPage
class RedirectPage(Page):
def serve(request):
# Link is a link to a page through a ForeignKey....
return redirect(self.link, permanent=True)
So, this will pick up the slug of IndexPage
instead of being at /