docs-devkit icon indicating copy to clipboard operation
docs-devkit copied to clipboard

Unexpected behavior of the versioning plugin

Open rexwangcc opened this issue 5 years ago • 2 comments

First of all, thank you for all of the great work you have done! I arrived here following the threads all the way from https://github.com/vuejs/vuepress/issues/1018

I have switched our theme from the default one to Titanium Theme for 2 reasons, the separate right-side content sidebar and the versioning support. While the right-side content sidebar works as a charm (side note: it'd would be even better and more convenient if it could be turned on from config.js for a whole directory than having to modify each individual md file's frontmatter especially when you already have thousnads of doc files.), we ran into some unexpected behaviors with the versioning plugin:

  1. The version switch doesn't work.
  2. The sidebar disappears unexpectedly when switching between versions.

In case I didn't setup the layout correctly in our own project, I did an experiment with a clone of this repo itself seeing if it could be reproduced by:

git clone [email protected]:appcelerator/docs-devkit.git
cd ./docs-devkit/packages/docs
yarn
yarn run createVersion 0.1.4
yarn run createVersion 0.1.5
...
yarn run createVersion 0.1.19
yarn dev

And both of the aforementioned can be reproduced.

I patched what's proposed in https://github.com/appcelerator/docs-devkit/pull/43 to the installed plugin in node_nodules, and that seems to fix 1., but 2. is still there (the sidebar is only showing up on next version and the pre-existing 0.1.3 version but not there in any other created versions)

Screen Shot 2020-09-30 at 1 50 14 PM Screen Shot 2020-09-30 at 1 50 20 PM Screen Shot 2020-09-30 at 1 50 28 PM

I'm planning to look into the source code of the plugin when I have time later, but it would be really appreciated if you are available to shed some light or even release a fix. Thanks!

rexwangcc avatar Sep 30 '20 17:09 rexwangcc

Hi, thanks for reporting this issue. We are aware of a couple of issues regarding the versioning plugin if you have more than two versions. Unfortunately we didn't have time yet to investigate and fix those. We are currently working on migrating our own docs to VuePress and are not at the stage yet to use the versioning plugin, so it has seen little attention lately.

Judging from a quick look at #43 i think it only works if you don't use the locales feature. Are you using locales? Anyway i'll try to give this a deeper look next week.

While the right-side content sidebar works as a charm (side note: it'd would be even better and more convenient if it could be turned on from config.js for a whole directory than having to modify each individual md file's frontmatter especially when you already have thousnads of doc files.) ...

You can easily do so with a little plugin and set the frontmatter programmatically. That way you don't have to touch your existing files: https://github.com/appcelerator/titanium-docs/blob/master/docs/.vuepress/guides-content-sidebar.js

janvennemann avatar Oct 08 '20 13:10 janvennemann

Thanks for you reply!

Judging from a quick look at #43 i think it only works if you don't use the locales feature. Are you using locales? Anyway i'll try to give this a deeper look next week. Yes, we are using i18n and have more than 1 locale, so it will not work for our use case after taking a closer look.

We ended up implementing a light-weight script that simply copies the versioned docs per release and tweak the nav links to separate the versioning. Also thanks for the pointer above!

rexwangcc avatar Oct 15 '20 15:10 rexwangcc