vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

Versioning

Open fimbault opened this issue 5 years ago • 16 comments

Is your feature request related to a problem? Please describe. Related to documentation versioning

Describe the solution you'd like A way to version a set of markdown documents

Describe alternatives you've considered Similar to VuePress Plugin or Docusaurus2

fimbault avatar Oct 27 '20 10:10 fimbault

Well there is another workaround. Move your old docs to a subdomain. Then you can write config like this:

import { defineConfig } from 'vitepress'

export default defineConfig({
  themeConfig: {
    nav: [
      {
        text: 'v3 (stable)',
        items: [
          {
            text: 'v2 (legacy)',
            link: 'https://v2.vuejs.org/'
          }
        ]
      }
    ]
  }
})

It will be rendered like this:

image

brc-dd avatar Jun 03 '22 09:06 brc-dd

hi again @brc-dd - do you have recommended practices on moving old versions to subdomain? if you do, have you seen anyone do this on github pages? we're thinking of moving another docs site to vitepress, but this is the one remaining blocker

jcstein avatar Aug 22 '23 17:08 jcstein

+1 this would really be essential. I'm trying to think of how to build this in VitePress, but I'm not sure at the moment.

DMiradakis avatar Oct 31 '23 21:10 DMiradakis

I’m pretty sure this is just done with multiple sidebars. Just move your versioned docs to a subfolder with the version in them.

You can then add a link to the nav where a user selects the version, and on change, the correct sidebar will show.

drwpow avatar Nov 19 '23 01:11 drwpow

I've utilized multiple sidebars, a nav switcher etc. to create a versioning example that should suffice for most projects until proper versioning support is added.

You can view it here: ~~https://github.com/IMB11/vitepress-versioning~~ Now a plugin on NPM! https://www.npmjs.com/package/vitepress-versioning-plugin

Im unsure how to make it a library, or whether it's even worth being a library

IMB11 avatar Dec 26 '23 19:12 IMB11

Well there is another workaround. Move your old docs to a subdomain. Then you can write config like this:

I would not consider this a workaround primarily because it assumes you have a domain. For users that use GitHub Pages without a custom domain, it is not possible.

A workaround, in my opinion, is something that can be done purely within the constraints of VitePress. The approaches that @drwpow and @IMB11 provided I would consider workarounds.

ciscoo avatar Jan 15 '24 17:01 ciscoo

I actually ended up turned my example into a proper plugin/library: https://www.npmjs.com/package/vitepress-versioning-plugin

IMB11 avatar Jan 15 '24 18:01 IMB11