Skip to content

Version dropdown: should the "version_match" match the version or the name of the version? #556

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

See https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/configuring.html#configure-switcher-version-match for the explanation of the feature.

For the configuration of the version dropdown, you provide a json like

[
    {
        "name": "v2.1 (stable)",
        "version": "2.1"
    },
...
]

and so when specifying the switcher['version_match'] in conf.py, there are two potential things that it could match: the "name" or the "version" from the json file.

Currently, it tries to match the version:

// replace dropdown button text with the preferred display name of
// this version, rather than using sphinx's {{ version }} variable.
// also highlight the dropdown entry for the currently-viewed
// version's entry
if (entry.version == "{{ theme_switcher.get('version_match') }}") {
node.classList.add("active");
$("#version_switcher_button").text(entry.name);
}

While starting to use the version dropdown for the pandas docs, I actually implemented this to match the "name" (pandas-dev/pandas#45370). The reason for this is because our "version" needs to follow the url scheme, and for historical reasons this is a bit complicated (so in our versions.json, the "name" entry is simpler)

Now, our case might of course be a bit specific.
But so that did me wonder in general which of the two would in practice be the most useful to try to match?

(cc @drammock)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: discussionNeeds discussion before an implementation can be made

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions