Skip to content

Commit

Permalink
add : Manage versions
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelships committed Mar 15, 2021
1 parent c177c57 commit f98adef
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions packages/docusaurus-init/templates/classic/docs/manage-versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Manage Versions
---

Docusaurus gives you the option to have different versions of your docs,
allowing you to update and have previous versions available.


### Tagging a new version
To tag a new version make sure the content in the `docs` directory is ready to be
frozen as a version. Run the following command to tag a version


```bash
npm run docusaurus docs:version <version>
```
When a new `version` is tagged, the `docs/` directory content will be copied into `versioned_docs/version-<version>/` folder. A [sidebar](https://v2.docusaurus.io/docs/docs-introduction#sidebar) configuration will also be copiend and the version number added to `versions.json`.

## Updating an existing version
You can edit any version in its specific folder, comit and push changes and it will be published to that version.
Example when you change any file in `versioned_docs/version-2.6/`, it will only affect the docs for `version 2.6`


## Deleting an existing version
You can delete an existing version by removing the version from `versions.json` file, deleting the docs directory,
Example : `versioned_docs/version-1.8.0` and deleting the versioned sidebar file, Example : `versioned_sidebars/version-1.8.0-sidebars.json`.

After tagging a new version or deleting an existing version, you can restart the site with `yarn restart` or `npm restart`.
2 changes: 1 addition & 1 deletion packages/docusaurus-init/templates/classic/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
{
type: 'category',
label: 'Extras',
items: ['deploy-your-site', 'translate-your-site'],
items: ['deploy-your-site', 'translate-your-site', 'manage-versions'],
},
],
};

0 comments on commit f98adef

Please sign in to comment.