jimporter / mike

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

set default function not working #91

Closed jerrywheeler closed 2 years ago

jerrywheeler commented 2 years ago

https://intel-secl.github.io/docs/

we have set 4.1 as the default but is does not go to 4.1 or 4.0 if we set it..

you can see the architecture in the above repro

jimporter commented 2 years ago

This seems to be working correctly at the time of my message. However, it appears you didn't run mike delete --all (see the README), so you have some stale unversioned files in your gh-pages branch from running mkdocs directly.

Since things look correct to me (aside from the minor issue mentioned above), I'm closing this. If there are other problems, feel free to comment here and I'll take another look.

jerrywheeler commented 2 years ago

I cant get the versioning option to show up at https://intel-secl.github.io/docs/

If I goto https://intel-secl.github.io/docs/4.1 then it shows up

I ran mike delete --all before redeploying the updated docs

jimporter commented 2 years ago

At some point after setting the default to 4.1 (see this commit), you ran mkdocs gh-deploy, replacing the root index.html in this commit. If you overwrite index.html like that, then you'll lose the redirection behavior you want.

jerrywheeler commented 2 years ago

so after i push my new code,

what would the order be? mkdocs gh-deploy run mike deploy (version) --push for all 3 versions then run mike set-default 4.1

jimporter commented 2 years ago

You should never be running mkdocs gh-deploy. That's only for deploying unversioned documentation.

jerrywheeler commented 2 years ago

ok, so commit my new code

run: mike deploy 4.0 --push mike deploy 4.0.1 --push mike deploy 4.1 --push mike set-default 4.1

jimporter commented 2 years ago

Generally speaking, you only need to call mike set-default if the default has actually changed. For the deploy commands, that's really up to you how you want your resulting docs to be structured. The README explains the various options for deploying in more detail.

jerrywheeler commented 2 years ago

so when i run: mike delete --all --push mike deploy 4.0 --push mike deploy 4.0.1 --push mike deploy 4.1 --push

i get a 404 at https://intel-secl.github.io/docs/

but https://intel-secl.github.io/docs/4.1 works with versioning - is there a way for https://intel-secl.github.io/docs/ to load 4.1 version?

jimporter commented 2 years ago

If you delete everything (with mike delete --all), then yes, you would need to call mike set-default again. However, as the README describes, mike delete --all is useful for when "you have existing documentation on your gh-pages branch" before you start using mike, so you only need to run that once.

If you're still confused about what's happening, I recommend examining the commit history generated on your gh-pages branch. It should then be clearer what each command you're running actually does.

jerrywheeler commented 2 years ago

thanks for your help, I finally got it working