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

Document versions.json workaround when a server doesn't automatically forward to index.html #276

Open
maarten-ic opened this issue Aug 10, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@maarten-ic
Copy link

I found the version switcher does not work out-of-the box when the server where the documentation is deployed doesn't forward a request to a directory (e.g. "docs/2.0/") to the index.html in that directory (e.g. "docs/2.0/index.html").
I did find a way to make this work though, which may be nice to document for others that encounter this problem.

Instead of the regular versions.json

[
  {"version": "2.0", "title": "2.0", "aliases": ["latest"]},
  {"version": "1.0", "title": "1.0", "aliases": []},
]

I used the following

[
  {"version": "2.0/index.html#", "title": "2.0", "aliases": ["2.0", "latest"]},
  {"version": "1.0/index.html#", "title": "1.0", "aliases": ["1.0"]},
]

Since the redirect URL is built as: ${base_url}/../${version}/ (source) this will now create a link directly to the index.html page. The folder name is included in the aliases field such that the setupVersionSelector (source) can still find out which version you're looking at.

@2bndy5 2bndy5 added the documentation Improvements or additions to documentation label Aug 10, 2023
@2bndy5
Copy link
Collaborator

2bndy5 commented Aug 10, 2023

You are welcome to submit a PR to modify the doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants