-
Notifications
You must be signed in to change notification settings - Fork 348
Closed
Milestone
Description
Re #1795
Hello,
using Sphinx 8.0.2 with pydata-sphinx-theme 0.15.4 (or 0.16.0rc0), I am trying to get the version-switcher working with the dirhtml builder and ran into two issues:
- Page names like
api/index
(DOCUMENTATION_OPTIONS.pagename = 'api/index'
) are mapped toapi/index/
, notapi/
- Some urls contain double slashes
//
, as already noted in fix version-switcher with dirhtml builder #1795 (comment)
The following patch works for me, but I haven't formally tested it:
diff --git a/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js b/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js
index 0c876e6..03a42a2 100644
--- a/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js
+++ b/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js
@@ -346,8 +346,8 @@ var setupSearchButtons = () => {
*/
var getCurrentUrlPath = () => {
if (DOCUMENTATION_OPTIONS.BUILDER == "dirhtml") {
- return DOCUMENTATION_OPTIONS.pagename == "index"
- ? `/`
+ return DOCUMENTATION_OPTIONS.pagename.endsWith("index")
+ ? `${DOCUMENTATION_OPTIONS.pagename.substring(0, DOCUMENTATION_OPTIONS.pagename.length - 5)}`
: `${DOCUMENTATION_OPTIONS.pagename}/`;
}
return `${DOCUMENTATION_OPTIONS.pagename}.html`;
Does this look correct?
Metadata
Metadata
Labels
No labels