Skip to content

How are variants chosen where there are multiple matching segments? #204

Open
@mattlinares

Description

@mattlinares

If a page has multiple segment variants and a user matches more than one of those segments, how does the module choose which variant to show to the user? This is not stated anywhere that I can see in the docs.

I think it occurs inside of:

@hooks.register('before_serve_page')
def serve_variant()

on line 118 of wagtail_hooks.py:

variant = metadata.first().variant.specific

but that seems a little arbitrary as it just picks the first variant in the list. There is a TODO in that may refer to this issue but is a little unclear.

Anyway, if this is the case, it would be good to mention it in the docs. I'd be happy to add that to the docs if we can clarify.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions