Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version switch to docs #457

Merged
merged 7 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
39 changes: 39 additions & 0 deletions docs/_static/switcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[

{
"name":"v0.5.0",
"version":"0.5.0",
"url":"https://deltares.github.io/hydromt/v0.5.0/"

},
{
"name":"v0.6.0",
"version":"0.6.0",
"url":"https://deltares.github.io/hydromt/v0.6.0/"

},
{
"name":"v0.7.0",
"version":"0.7.0",
"url":"https://deltares.github.io/hydromt/v0.7.0/"

},
{
"name":"v0.7.1",
"version":"0.7.1",
"url":"https://deltares.github.io/hydromt/v0.7.1/"

},
{
"name":"v0.8.0",
"version":"0.8.0",
"url":"https://deltares.github.io/hydromt/v0.8.0/"

},
{
"name":"latest",
"version":"latest",
"url":"https://deltares.github.io/hydromt/latest/"

}
]
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Unreleased

Added
-----
-
- docs now include a dropdown for selecting older versions of the docs. (#457)

Changed
-------
Expand Down
10 changes: 8 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def clean_str(s):
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
bare_version = hydromt.__version__
doc_version = bare_version[: bare_version.find("dev") - 1]
html_static_path = ["_static"]
html_css_files = ["theme-deltares.css"]
html_theme_options = {
Expand All @@ -257,14 +259,18 @@ def clean_str(s):
"logo": {
"text": "HydroMT Core",
},
"navbar_end": ["navbar-icon-links"], # remove dark mode switch
"navbar_end": ["navbar-icon-links", "version-switcher"], # remove dark mode switch
"switcher": {
"json_url": "https://raw.githubusercontent.com/Deltares/hydromt/doc-version-switcher/docs/_static/switcher.json",
savente93 marked this conversation as resolved.
Show resolved Hide resolved
"version_match": doc_version,
},
}

html_context = {
"github_url": "https://github.com", # or your GitHub Enterprise interprise
"github_user": "Deltares",
"github_repo": "hydromt",
"github_version": "main", # FIXME
"github_version": "main",
"doc_path": "docs",
"default_mode": "light",
}
Expand Down
Loading