jimporter / mike

Manage multiple versions of your MkDocs-powered documentation via Git
BSD 3-Clause "New" or "Revised" License
511 stars 45 forks source link

gh-pages redirect/forward to default version not working #181

Closed alexschroeter closed 9 months ago

alexschroeter commented 9 months ago

Summary

Issue with the initial redirect/forward to the default version. I have been playing a bit with a setup but I am unable to get the redirect/forward to the default version workings. It is working with mike serve but when I use github pages I stay on the initial index.html without the version selector. I have seen a problem in the browsers web console which has been mentioned a couple of times in the forum where the versions.json isn't found but I believe this is because I am not being redirected to the real default/index.html and therefore the path ../versions.json isn't correct. When I go to the defaults site directly everything seems to work out.

It would be great to get a pointer because I cannot figure out why it is not working.

Thanks Alex

jimporter commented 9 months ago

This bit is your problem: https://github.com/fast-microscopy/test-actions/blob/5fd84d5a9e6fa395905c0272331c9441925b7640/.github/workflows/documentation_release.yml#L32-L37

You're overwriting the index.html redirect page (which gets generated by mike set-default) with the temporary generated docs in your site/ directory (as generated by mkdocs build internally in the mike deploy process). Try removing that block, then running mike set-default <your-favorite-version> (you can just do this locally and then push your gh-pages branch back upstream) to fix everything up.

alexschroeter commented 9 months ago

Thank you, Jim.

If I understand correctly I have shot myself in the foot by manually uploading the content of the site folder to the gh-pages repo because mike actually already handles all of this. And the --push flag just creates a subdirectory in the branch that holds that version. My assumption that mike serve just serves the site folder was also wrong and it serves all the versions available according to mike list with the structure of the gh-pages repo and site is more like a temp folder for the build process.

Thank you again for the help, everything seems to be working and I think I understand a bit better now.