Mirror of https://forge.levinkeller.de/levin/dorfarchiv.git
141ee6795164aa968880489dbc53a69a6c10e1c8
| 1 | --- |
| 2 | sidebar_position: 1 |
| 3 | --- |
| 4 | |
| 5 | # Manage Docs Versions |
| 6 | |
| 7 | Docusaurus can manage multiple versions of your docs. |
| 8 | |
| 9 | ## Create a docs version |
| 10 | |
| 11 | Release a version 1.0 of your project: |
| 12 | |
| 13 | ```bash |
| 14 | npm run docusaurus docs:version 1.0 |
| 15 | ``` |
| 16 | |
| 17 | The `docs` folder is copied into `versioned_docs/version-1.0` and `versions.json` is created. |
| 18 | |
| 19 | Your docs now have 2 versions: |
| 20 | |
| 21 | - `1.0` at `http://localhost:3000/docs/` for the version 1.0 docs |
| 22 | - `current` at `http://localhost:3000/docs/next/` for the **upcoming, unreleased docs** |
| 23 | |
| 24 | ## Add a Version Dropdown |
| 25 | |
| 26 | To navigate seamlessly across versions, add a version dropdown. |
| 27 | |
| 28 | Modify the `docusaurus.config.js` file: |
| 29 | |
| 30 | ```js title="docusaurus.config.js" |
| 31 | export default { |
| 32 | themeConfig: { |
| 33 | navbar: { |
| 34 | items: [ |
| 35 | // highlight-start |
| 36 | { |
| 37 | type: 'docsVersionDropdown', |
| 38 | }, |
| 39 | // highlight-end |
| 40 | ], |
| 41 | }, |
| 42 | }, |
| 43 | }; |
| 44 | ``` |
| 45 | |
| 46 | The docs version dropdown appears in your navbar: |
| 47 | |
| 48 |  |
| 49 | |
| 50 | ## Update an existing version |
| 51 | |
| 52 | It is possible to edit versioned docs in their respective folder: |
| 53 | |
| 54 | - `versioned_docs/version-1.0/hello.md` updates `http://localhost:3000/docs/hello` |
| 55 | - `docs/hello.md` updates `http://localhost:3000/docs/next/hello` |