Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/user_guide/configuring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ each can have the following fields:
switcher.
- ``name``: an optional name to display in the switcher dropdown instead of the
version string (e.g., "latest", "stable", "dev", etc).
- ``extra_classes``: an optional list of classes to add to the switcher
button for a given version (e.g., ``["dev", "rc"]``). These classes are only
added when the version is active.
- ``url``: an optional URL. If provided, it links the version to ``url``
instead of ``switcher['url_template']``.

Expand All @@ -398,6 +401,10 @@ Here is an example JSON file:
"name": "v2.1 (stable)",
"version": "2.1"
},
{
"version": "2.1rc1",
"extra_classes": ["dev", "rc"]
},
{
"version": "2.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
if (entry.version == "{{ theme_switcher.get('version_match') }}") {
node.classList.add("active");
$("#version_switcher_button").text(entry.name);
// Add extra class to the button for the selected entry
if ("extra_classes" in entry) {
$("#version_switcher_menu").classList.add(...entry.extra_classes);
}
}
});
});
Expand Down