I have a site that I've structured like so:
Top Page: Animals
Subpage: Cat
Subpage: Dog
Top Page: Cat
Subpage: Food
Top Page: Dog
Subpage: Food
That way, a user can go to site/animals or site/cat. Animals is high-level info, Cat and Dog are more detailed parts of the site.
What I want to do:
Occasionally, I want to be able to reuse pages from Animals and use them in Cat or Dog. But I don't want the url to switch from one section to another.
Example: If the user is under Animal, and they click a food article, the url should be:
animals/cats/food_article
If they click on that same article under cats, the url should look like:
cats/food_article
What I've tried:
I've tried using RoutableRouteMixin
. But that works for subpages, not for pages at the same level.
I tried overwriting the get_url_parts
method for the article models. But then I got 404 errors because the pages didn't actually exist at the url I created.
Can this be achieved in Wagtail? Or is there a Django solution I can use with Wagtail?