-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Docs version selector #11602
base: main
Are you sure you want to change the base?
Feat: Docs version selector #11602
Conversation
|
a0d2c02
to
8221afc
Compare
Thanks for the POC, appriciate the effort! This assumes that the pages stay the same though. We're not really sure that will be the case. We might instead want to freeze the v4 docs in time and deploy them at v4.svelte.dev, and put most of the docs in a legacy section on the new site. Nothing set in stone yet, so it's best to hold off from further exploration for now. |
@dummdidumm I'm not exactly sure what you mean. Do you mind checking out the PR and running with the new changes I made? I think that will explain things better.
It really doesn't (or I misunderstood what you meant), they don't have to stay the same. The idea is that a version switcher would allow anything as the new docs, possibly even a new structure/interface, while keeping the old docs intact and accessible.
My version switcher does exactly that, but provides them on the same site at |
7b03049
to
9904495
Compare
POC for a documentation version switcher on the
svelte.dev
site - see issue #11599 for more details.How to test
Just clone the PR, run
pnpm install
andnpm run dev
. By default, the Svelte 5 docs will load. Use the version switcher in the top-left to see the documentation for any Svelte version. Example links (need to have the dev server running to be able to open them):How it works
git checkout --work-tree=<some-path> <some-revision> -- documentation
. This command checks out the documentation folder from a specific branch. Each version is checked out into its own directory.scripts/previous-docs/v[123]/config.json
. Most importantly, they specify a regex for matching git tags./docs/[[version]]/[slug]
. Ifversion
is not specified, it loads the docs normally. Otherwise, it loads the docs for the specified version. Currently onlyv4
is added toversions.js
, which contains the docs from thesvelte-4
branch, so going to/docs/v4
will display the docs from thesvelte-4
branch (what's currently live on svelte.dev)What it does
In its current shape, it loads the documentation for the latest patch version of every minor release for Svelte 3, 4, and every next version for Svelte 5. Each version is then accessed using the path
/docs/v-<version>/<page>
.<page
is the usual page slug, such asintroduction
orsvelte-components
.<version>
is the version you want to use, such as3.0
,4.2
or5.0.0-next.100
.Why
DX-wise, the goal is to allow easy maintenance of multiple versions without having to worry about bringing documentation to the
main
branch. For the users, this means being able to access the documentation for your exact version, so you don't have to stumble across features that aren't available for you.Svelte 5 rewrite
Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (
main
).If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is
svelte-4
and notmain
.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint