IMB11 / vitepress-versioning-plugin

A highly customizable versioning plugin for VitePress v1
https://vvp.imb11.dev/
MIT License
11 stars 3 forks source link

Older versions redirect to 404 #3

Open Amitzw2 opened 3 months ago

Amitzw2 commented 3 months ago

When choosing an older version from the versions menu, I am redirected to /0.1 which doesn’t exist (leads to 404). The version’s page (which saved in versions/0.1/index.md) is only served through /versions/0.1 and could only be accessed through there.

Is there a way to make it serve older versions without /versions before the version?

IMB11 commented 3 months ago

Could you show me your configuration and page folder structure?

Amitzw2 commented 3 months ago

My page folder is structured like this: Inside my “docs” directory:

As for configuration, I have my config.mts:

Also, inside .vitepress I have a sidebars directory, with a versioned directory inside and a file named “1.3.2.json”.

Thanks! :)

Zw1lling commented 2 months ago

Hey same guy here, I am only going to use this account in the future.

I tried to reproduce this bug on another computer, and it did come up again. I wanted to make sure I did it as pure as possible without changing anything I shouldn't (to make sure it wasn't some misconfiguration on my end). To reproduce I have done these steps:

  1. Installed vitepress (latest - 1.1.3).
  2. Installed vitepress-versioning-plugin (latest).
  3. Ran vitepress init to create a fresh vitepress project.
  4. Replaced defineConfig with defineVersionedConfig.
  5. Added versioning and versioning.latestVersion: "2.0.0" to the config.mts.
  6. Created a folder named "1.0.0" inside the "versions" folder.
  7. Ran vitepress dev
  8. Tried to access version 1.0.0 through the version switcher.

I managed to get the same result as before, and clicking on 1.0.0 inside the version switcher resulted in a 404 error.

To test it in another way and make sure it was a bug, I cloned the plugin repo locally and ran the test-docs on my computer to check this issue (using the viterpess dev command). I received the same result.

Both times choosing a version redirected me to /version (e.g. http://localhost:5173/0.1.0/) which resulted in a 404 page. There is no page called 0.1.0 inside the main directory, so it does make sense. Trying to access the older version (0.1.0) through a link, I tried using /versions/0.1.0. It did work and I could see what was meant to be shown for version 0.1.0.

Trying to choose a version through the switcher: image

Trying to access /versions/0.1.0: image

I tried to edit the switcher definition and added versions/ on line 27 of switcher.ts. This expectedly resulted in the same result shown in the second picture, and I think it could be a solution to this problem.

@IMB11 Have you seen this issue happen to anyone else? Or could it still be something with my usage? If it happens for everyone should I open a PR that fixes just that?

IMB11 commented 2 months ago

Do you have a GitHub repo I can reproduce this with? Im struggling to manually try and trigger the issue using a blank setup.

Zw1lling commented 2 months ago

Added you to a private repo here. Running vitepress dev in this repo should reproduce what I'm talking about.

IMB11 commented 2 months ago

I'll look at this throughout the week :)

Zw1lling commented 2 months ago

Hey! Have you looked into this by any chance?

IMB11 commented 2 months ago

I'll have to look at in sometime in the future, not got alot of time lately

IMB11 commented 1 month ago

I cant reproduce this, I've been trying for a good hour now, not sure what is happening, it could just be a cache issue on your end?