wagtail-nest / wagtail-personalisation

Rule-based personalisation for Wagtail CMS
http://wagxperience.io/
MIT License
120 stars 34 forks source link

Best practice for index pages #189

Open tm-kn opened 6 years ago

tm-kn commented 6 years ago

I've been wondering what's the best practice for displaying variant pages that are children of an index page and are displayed on that index page. Currently the best solution in my opinion is to use utils.exclude_variant_pages on each queryset I want to display publicly, but it seems a bit tedious to do. Do you have any better ideas or options? Probably worth documenting as well.

bmoe872 commented 5 years ago

I'm running into a similar requirement, but I am also curious if using that exlcude_variant_pages is the best approach.

tm-kn commented 5 years ago

Sorry, I mean this - https://github.com/wagtail/wagtail-personalisation/blob/43b5b62e6021759a77671d36f7432ab10947ebff/src/wagtail_personalisation/utils.py#L101-L113

You can use that function to filter out the QuerySet from the variant pages, just display canonical pages. Variant pages should be not visible to users as separate pages.

bmoe872 commented 5 years ago

@tm-kn yeah I figured that out pretty quickly after I sent the first post. Sorry about that. I edited my original, because I am also curious if that is best practice.