<html><head><metacharset="utf-8"/><metahttp-equiv="X-UA-Compatible"content="IE=edge, chrome=1"/><title>Versioning · Docusaurus</title><metaname="viewport"content="width=device-width"/><metaname="generator"content="Docusaurus"/><metaproperty="og:title"content="Versioning · Docusaurus"/><metaproperty="og:type"content="website"/><metaproperty="og:url"content="https://docusaurus.io/index.html"/><metaproperty="og:description"content="You can use the `version` script to cut a new documentation version based on the latest content in the `docs` folder. That specific set of documentation will then be preserved and accessible even as the documentation in the `docs` folder changes moving forward."/><metaname="robots"content="noindex"/><linkrel="shortcut icon"href="/img/docusaurus.ico"/><linkrel="stylesheet"href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><linkrel="stylesheet"href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-dark.min.css"/><linkrel="alternate"type="application/atom+xml"href="https://docusaurus.io/blog/atom.xml"title="Docusaurus Blog ATOM Feed"/><linkrel="alternate"type="application/rss+xml"href="https://docusaurus.io/blog/feed.xml"title="Docusaurus Blog RSS Feed"/><scripttype="text/javascript"src="https://buttons.github.io/buttons.js"></script><linkrel="stylesheet"href="/css/main.css"/></head><bodyclass="sideNavVisible"><divclass="fixedHeaderContainer"><divclass="headerWrapper wrapper"><header><ahref="/"><imgclass="logo"src="/img/docusaurus.svg"/><h2class="headerTitle">Docusaurus</h2></a><divclass="navigationWrapper navigationSlider"><navclass="slidingNav"><ulclass="nav-site nav-site-internal"><li><ahref="/docs/en/installation.html"target="_self">Docs</a></li><li><ahref="/en/help.html"target="_self">Help</a></li><li><ahref="/en/about-slash.html"target="_self">About/</a></li><li><ahref="/blog"target="_self">Blog</a></li><li><ahref="https://github.com/facebook/docusaurus"target="_self">GitHub</a></li><liclass="navSearchWrapper reactNavSearchWrapper"><inputtype="text"id="search_input_react"placeholder="Search"/></li></ul></nav></div></header></div></div><divclass="navPusher"><divclass="docMainWrapper wrapper"><divclass="container docsNavContainer"id="docsNav"><navclass="toc"><divclass="toggleNav"><sectionclass="navWrapper wrapper"><divclass="navBreadcrumb wrapper"><divclass="navToggle"id="navToggler"><i></i></div><h2><i>›</i><span>Guides</span></h2></div><divclass="navGroups"><divclass="navGroup navGroupActive"><h3>Getting Started</h3><ul><liclass="navListItem"><aclass="navItem"href="/docs/en/installation.html">Installation</a></li><liclass="navListItem"><aclass="navItem"href="/docs/en/site-preparation.html">Site Preparation</a></li><liclass="navListItem"><aclass="navItem"href="/docs/en/site-creation.html">Creating your site</a></li><liclass="navListItem"><aclass="navItem"href="/docs/en/publishing.html">Publishing your site</a></li></ul></div><divclass="navGroup navGroupActive"><h3>Guides</h3><ul><liclass="navListItem"><aclass="navItem"href="/docs/en/custom-pages.html">Custom Pages</a></li><liclass="navListItem"><aclass="navItem"href="/docs/en/navigation.html">Navigation and Sidebars</a></li><liclass="navListItem"><aclass="navItem"href="/docs/en/blog.html">Adding a Blog</a></li><liclass="navListItem"><aclass="navItem"href="/docs/en/translation.html">Translations & Localization</a></li><liclass="navListItem"><aclass="navItem"href="/docs/en/search.html">Enabling Search</a></li><liclass="navListItem navListItemActive"><aclass="navItem navItemActive"href="/docs/en/versioning.html">Versioning</a></li></ul></div><divclass="navGroup navGroupActive"><h3>API</h3><ul><liclass="navListItem"><aclass="navItem"href="/docs/en/commands.html">CLI Commands</a></li><liclass="navListItem"><aclass="navItem"href="/docs/en/api-pages.html">Pages and Styles</a></li><liclass="navListItem"><aclass="navItem"href="/docs/en/site-config.html">siteConfig.js</a></li><liclass="navListItem">
var toggler = document.getElementById('navToggler');
var nav = document.getElementById('docsNav');
toggler.onclick = function() {
nav.classList.toggle('docsSliderActive');
};
</script></nav></div><divclass="container mainContainer"><divclass="wrapper"><divclass="post"><headerclass="postHeader"><aclass="edit-page-link button"href="https://github.com/facebook/docusaurus/edit/master/docs/guides-versioning.md"target="_blank">Edit</a><h1>Versioning</h1></header><article><div><span><p>You can use the <code>version</code> script to cut a new documentation version based on the latest content in the <code>docs</code> folder. That specific set of documentation will then be preserved and accessible even as the documentation in the <code>docs</code> folder changes moving forward.</p>
<p>You can edit this file later on to customize how you display the versions.</p>
<p>Add the following script to your <code>package.json</code> file if it doesn't already exist:</p>
<pre><codeclass="hljs css json">...
"scripts": {
"version": "docusaurus-version"
},
...
</code></pre>
<p>Run the script with a command line argument of the version you wish to create. e.g.,</p>
<pre><codeclass="hljs css bash">yarn run version 1.0.0
</code></pre>
<p>This will preserve all documents currently in the <code>docs</code> folder and make them available as documentation for version <code>1.0.0</code>.</p>
<p>If, for example, you ran the version script with 1.0.0 as the version number, version 1.0.0 is considered the latest release version for your project. The site will display the version number next to the title in the header. This version number links to a versions page that you created earlier.</p>
<p>Documents in the <code>docs</code> folder will be considered part of version <code>next</code> and they are available, for example, at the url <code>docs/next/doc1.html</code>. Documents from the latest version use the url <code>docs/doc1.html</code>.</p>
<p>Running the script again with <code>yarn run version 2.0.0</code> will create a version <code>2.0.0</code>, making version 2.0.0 the most recent set of documentation. Documents from version <code>1.0.0</code> will use the url <code>docs/1.0.0/doc1.html</code> while <code>2.0.0</code> will use <code>docs/doc1.html</code>.</p>
<p>You can create version numbers in whatever format you wish, and a new version can be created with any version number as long as it does not match an existing version. Version ordering is determined by the order in which versions are created, independently of how they are numbered.</p>
<p>Versioned documents are placed into <code>website/versioned_docs/version-${version}</code>, where <code>${version}</code> is the version number you supplied the <code>version</code> script.</p>
<p>The markdown header for each versioned doc is altered by renaming the id frontmatter field to <code>original_id</code>, then using <code>"version-${version}-${original_id}"</code> as the value for the actual <code>id</code> field.</p>
<p>Versioned sidebars are copied into <code>website/versioned_sidebars</code> and are named as <code>version-${version}-sidebars.json</code>.</p>
<p>A <code>website/versions.json</code> file is created the first time you cut a version and is used by Docusaurus to detect what versions exist. Each time a new version is added, it gets added to the <code>versions.json</code> file.</p>
<p>If you wish to change the documentation for a past version, you can access the files for that respective version.</p>
<p>Only files in the <code>docs</code> folder and sidebar files that differ from those of the latest version will get copied each time a new version is specified. If there is no change across versions, Docusaurus will use the file from the latest version with that file.</p>
<p>For example, a document with the original id <code>doc1</code> exists for the latest version, <code>1.0.0</code>, and has the same content as the document with the id <code>doc1</code> in the <code>docs</code> folder. When a new version <code>2.0.0</code> is created, the file for <code>doc1</code> will not be copied into <code>versioned_docs/version-2.0.0/</code>. There will still be a page for <code>docs/2.0.0/doc1.html</code>, but it will use the file from version <code>1.0.0</code>.</p>
<p>If you wish to use versioning and translations features, the <code>crowdin.yaml</code> file should be set up to upload and download versioned documents to and from Crowdin for translation. Translated, versioned files will go into the folder <code>translated_docs/${language}/version-${version}/</code>. For more information, check out the <ahref="translation.md">translations guide</a>.</p>