mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 09:07:29 +02:00
parent
e95c3a87b7
commit
c85228b830
14 changed files with 100 additions and 90 deletions
20
css/main.css
20
css/main.css
|
@ -82,13 +82,19 @@ a.anchor {
|
|||
}
|
||||
|
||||
a.hash-link {
|
||||
float: left;
|
||||
padding-right: 4px;
|
||||
margin-top: 4px;
|
||||
margin-left: -20px;
|
||||
line-height: 1.2;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
h1:hover a.hash-link,
|
||||
h2:hover a.hash-link,
|
||||
h3:hover a.hash-link,
|
||||
h4:hover a.hash-link {
|
||||
|
||||
h1:hover .hash-link,
|
||||
h2:hover .hash-link,
|
||||
h3:hover .hash-link,
|
||||
h4:hover .hash-link {
|
||||
opacity: 0.5;
|
||||
transition: none;
|
||||
}
|
||||
|
@ -158,7 +164,7 @@ header h2 {
|
|||
.wrapper {
|
||||
margin: 0px auto;
|
||||
max-width: 1024px;
|
||||
padding: 0 10px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.projectLogo {
|
||||
|
@ -1262,6 +1268,10 @@ nav.toc:last-child {
|
|||
nav.toc:last-child {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
a.anchor {
|
||||
top: -144px;
|
||||
}
|
||||
}
|
||||
.docsNavContainer nav.toc .navWrapper {
|
||||
padding: 0;
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/api-pages.md" target="_blank">Edit</a><h1>Pages and Styles</h1></header><article><div><span><p>Docusaurus provides support for writing pages as React components inside the <code>website/pages</code> folder which will share the same header, footer, and styles as the rest of the site.</p>
|
||||
<h2><a class="anchor" name="urls-for-pages"></a>Urls for Pages <a class="hash-link" href="#urls-for-pages">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="urls-for-pages"></a><a href="#urls-for-pages" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Urls for Pages</h2>
|
||||
<p>Any <code>.js</code> files in <code>website/pages</code> will be rendered to static html using the path of the file after "pages". Files in <code>website/pages/en</code> will also get copied out into <code>pages</code> and will OVERRIDE any files of the same name in <code>pages</code>. For example, the page for the <code>website/pages/en/help.js</code> file will be found at the url <code>${baseUrl}en/help.js</code> as well as the url <code>${baseUrl}help.js</code>, where <code>${baseUrl}</code> is the <code>baseUrl</code> field set in your <a href="/docs/en/site-config.html">siteConfig.js file</a>.</p>
|
||||
<h2><a class="anchor" name="page-require-paths"></a>Page Require Paths <a class="hash-link" href="#page-require-paths">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="page-require-paths"></a><a href="#page-require-paths" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Page Require Paths</h2>
|
||||
<p>Docusaurus provides a few useful React components for users to write their own pages, found in the <code>CompLibrary</code> module. This module is provided as part of Docusaurus in <code>node_modules/docusaurus</code>, so to access it, pages in the <code>pages</code> folder are temporarily copied into <code>node_modules/docusaurus</code> when rendering to static html. As seen in the example files, this means that a user page at <code>pages/en/index.js</code> uses a require path to <code>"../../core/CompLibrary.js"</code> to import the provided components.</p>
|
||||
<p>What this means to the user is that if you wish to use the <code>CompLibrary</code> module, make sure the require path is set correctly. For example, a page at <code>page/mypage.js</code> would use a path <code>"../core/CompLibrary.js"</code>.</p>
|
||||
<p>If you wish to use your own components inside the website folder, use <code>process.cwd()</code> which will refer to the <code>website</code> folder to construct require paths. For example, if you add a component to <code>website/core/mycomponent.js</code>, you can use the require path, <code>"process.cwd() + /core/mycomponent.js"</code>.</p>
|
||||
<h2><a class="anchor" name="provided-components"></a>Provided Components <a class="hash-link" href="#provided-components">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="provided-components"></a><a href="#provided-components" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Provided Components</h2>
|
||||
<p>Docusaurus provides the following components in <code>CompLibrary</code>:</p>
|
||||
<h3><a class="anchor" name="complibrarymarked"></a><code>CompLibrary.Marked</code> <a class="hash-link" href="#complibrarymarked">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="complibrarymarked"></a><a href="#complibrarymarked" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>CompLibrary.Marked</code></h3>
|
||||
<p>A React component that parses Markdown to html.</p>
|
||||
<p>Example:</p>
|
||||
<pre><code class="hljs css jsx"><span class="hljs-keyword">const</span> Marked = CompLibrary.Marked;
|
||||
|
||||
<span class="xml"><span class="hljs-tag"><<span class="hljs-name">Marked</span>></span>[Markdown syntax for a link](http://www.example.com)<span class="hljs-tag"></<span class="hljs-name">Marked</span>></span></span>
|
||||
</code></pre>
|
||||
<h3><a class="anchor" name="complibrarycontainer"></a><code>CompLibrary.Container</code> <a class="hash-link" href="#complibrarycontainer">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="complibrarycontainer"></a><a href="#complibrarycontainer" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>CompLibrary.Container</code></h3>
|
||||
<p>A React container component using Docusaurus styles. Has optional padding and background color attributes that you can configure.</p>
|
||||
<p>Padding choices: <code>all</code>, <code>bottom</code>, <code>left</code>, <code>right</code>, <code>top</code>.<br>
|
||||
Background choices: <code>dark</code>, <code>highlight</code>, <code>light</code>.</p>
|
||||
|
@ -29,7 +29,7 @@ Background choices: <code>dark</code>, <code>highlight</code>, <code>light</code
|
|||
...
|
||||
</Container>
|
||||
</code></pre>
|
||||
<h3><a class="anchor" name="complibrarygridblock"></a><code>CompLibrary.GridBlock</code> <a class="hash-link" href="#complibrarygridblock">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="complibrarygridblock"></a><a href="#complibrarygridblock" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>CompLibrary.GridBlock</code></h3>
|
||||
<p>A React component to organize text and images.</p>
|
||||
<p>The <code>align</code> attribute determines text alignment. Text alignment defaults to <code>left</code> and can be set to <code>center</code> or <code>right</code>.</p>
|
||||
<p>The <code>layout</code> attribute determines number of column sections per GridBlock. <code>layout</code> defaults to <code>twoColumn</code> and can be set to <code>threeColumn</code> or <code>fourColumn</code> as well.</p>
|
||||
|
@ -66,7 +66,7 @@ Background choices: <code>dark</code>, <code>highlight</code>, <code>light</code
|
|||
/>
|
||||
</code></pre>
|
||||
<p>More examples of how these components are used can be found in the <a href="/docs/en/site-preparation.html">generated example files</a> as well as in Docusaurus's own repo for its website set-up.</p>
|
||||
<h2><a class="anchor" name="translating-strings"></a>Translating Strings <a class="hash-link" href="#translating-strings">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="translating-strings"></a><a href="#translating-strings" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Translating Strings</h2>
|
||||
<p>When translations are enabled, any pages inside <code>website/pages/en</code> will be translated for all enabled languages. Urls for non-English pages will use their language tags as specified in the <code>languages.js</code> file. E.g. The url for a French page of <code>website/pages/en/help.js</code> would be found at <code>${baseUrl}fr/help.html</code>.</p>
|
||||
<p>When writing pages that you wish to translate, wrap any strings to be translated inside a <code><translate></code> tag. e.g.,</p>
|
||||
<pre><code class="hljs css jsx"><p><span class="xml"><span class="hljs-tag"><<span class="hljs-name">translate</span>></span>I like translations<span class="hljs-tag"></<span class="hljs-name">translate</span>></span></span><span class="xml"><span class="hljs-tag"></<span class="hljs-name">p</span>></span></span>
|
||||
|
@ -80,13 +80,13 @@ Background choices: <code>dark</code>, <code>highlight</code>, <code>light</code
|
|||
<pre><code class="hljs css js"><span class="hljs-keyword">const</span> translate = <span class="hljs-built_in">require</span>(<span class="hljs-string">"../../server/translate.js"</span>).translate;
|
||||
</code></pre>
|
||||
<p>Note that this path is valid for files inside <code>pages/en</code> and should be adjusted accordingly if files are in different locations, as discussed <a href="#page-require-paths">above</a>.</p>
|
||||
<h2><a class="anchor" name="using-static-assets"></a>Using Static Assets <a class="hash-link" href="#using-static-assets">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="using-static-assets"></a><a href="#using-static-assets" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Using Static Assets</h2>
|
||||
<p>Static assets should be placed into the <code>website/static</code> folder. They can be accesssed by their paths, excluding "static". For example, if the site's <code>baseUrl</code> is "/docusaurus/", an image in <code>website/static/img/logo.png</code> is available at <code>/docusaurus/img/logo.png</code>.</p>
|
||||
<h2><a class="anchor" name="styles"></a>Styles <a class="hash-link" href="#styles">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="styles"></a><a href="#styles" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Styles</h2>
|
||||
<p>You should configure your site's primary, secondary, and code block colors using the <code>colors</code> field in <code>siteConfig</code> as specified <a href="/docs/en/site-config.html">here</a>. You can also configure other colors in the same way as described in the <code>siteConfig</code> doc.</p>
|
||||
<p>You can provide your own custom styles by adding them anywhere in the <code>website/static</code> folder. Any <code>.css</code> files you provide in the <code>static</code> folder will get concatenated to the end of Docusaurus's provided styles, allowing you to add to or override Docusaurus default styles as you wish.</p>
|
||||
<p>An easy way to figure out what classes you wish to override or add to is to <a href="/docs/en/commands.html">start your server locally</a> and use your browser's inspect element tool.</p>
|
||||
<h2><a class="anchor" name="adding-static-pages"></a>Adding Static Pages <a class="hash-link" href="#adding-static-pages">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="adding-static-pages"></a><a href="#adding-static-pages" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Adding Static Pages</h2>
|
||||
<p>Static <code>.html</code> files can also be used, but they will not include Docusaurus's header, footer, or styles by default. These can be added to the <code>static</code> folder in the same way as other static assets. Alternatively, they can be placed in the <code>pages</code> folder and would be served as-is instead of being rendered from React.</p>
|
||||
<p>If you wish to use Docusaurus's stylesheet, you can access it at <code>${baseUrl}css/main.css</code>. If you wish to use separate css for these static pages, you can exclude them from being concatenated to Docusaurus's styles by adding them into the <code>siteConfig.separateCss</code> field.</p>
|
||||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="commands.html">← CLI Commands</a><a class="docs-next button" href="site-config.html">siteConfig.js →</a></div></div></div></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div><h5>Docs</h5><a href="
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
toggler.onclick = function() {
|
||||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/guides-blog.md" target="_blank">Edit</a><h1>Adding a Blog</h1></header><article><div><span><h2><a class="anchor" name="initial-setup"></a>Initial Setup <a class="hash-link" href="#initial-setup">#</a></h2>
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/guides-blog.md" target="_blank">Edit</a><h1>Adding a Blog</h1></header><article><div><span><h2><a class="anchor" aria-hidden="true" name="initial-setup"></a><a href="#initial-setup" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Initial Setup</h2>
|
||||
<p>To setup your site's blog, start by creating a <code>blog</code> folder within your repo's <code>website</code> directory.</p>
|
||||
<p>Then, add a header link to your blog within <code>siteConfig.js</code>:</p>
|
||||
<pre><code class="hljs"><span class="hljs-string">headerLinks:</span> [
|
||||
|
@ -13,7 +13,7 @@
|
|||
...
|
||||
]
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="adding-posts"></a>Adding Posts <a class="hash-link" href="#adding-posts">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="adding-posts"></a><a href="#adding-posts" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Adding Posts</h2>
|
||||
<p>To publish in the blog, create a file within the blog folder with a formatted name of <code>YYYY-MM-DD-My-Blog-Post-Title.md</code>. The post date is extracted from the file name.</p>
|
||||
<p>For example, at <code>website/blog/2017-08-18-Introducing-Docusaurus.md</code>:</p>
|
||||
<pre><code class="hljs"><span class="hljs-meta">---</span>
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
<span class="hljs-string">Lorem</span> <span class="hljs-string">Ipusm..</span>
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="header-options"></a>Header Options <a class="hash-link" href="#header-options">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="header-options"></a><a href="#header-options" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Header Options</h2>
|
||||
<p>The only required field is <code>title</code>; however, we provide options to add author information to your blog post as well.</p>
|
||||
<ul>
|
||||
<li><code>author</code> - The text label of the author byline.</li>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<li><code>authorFBID</code> - The Facebook ID that is used to extract the profile picture.</li>
|
||||
<li><code>title</code> - The blog post title.</li>
|
||||
</ul>
|
||||
<h2><a class="anchor" name="summary-truncation"></a>Summary Truncation <a class="hash-link" href="#summary-truncation">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="summary-truncation"></a><a href="#summary-truncation" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Summary Truncation</h2>
|
||||
<p>Use the <code><!--truncate--></code> marker in your blog post to represent what will be shown as the summary when viewing all blog published blog posts. Anything above <code><!--truncate--></code> will be part of the summary. For example:</p>
|
||||
<pre><code class="hljs"><span class="hljs-meta">---</span>
|
||||
<span class="hljs-attr">title:</span> <span class="hljs-string">Truncation</span> <span class="hljs-string">Exmaple</span>
|
||||
|
@ -51,7 +51,7 @@
|
|||
|
||||
<span class="hljs-string">Or</span> <span class="hljs-string">this.</span>
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="rss-feed"></a>RSS Feed <a class="hash-link" href="#rss-feed">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="rss-feed"></a><a href="#rss-feed" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>RSS Feed</h2>
|
||||
<p>Docusaurus provides a simple RSS feed for your blog posts. Both RSS and Atom feed formats are supported. This data is automatically to your website page's HTML <HEAD> tag.</p>
|
||||
<p>A summary of the post's text is provided in the RSS feed up to the <code><!--truncate--></code>. If no <code><!--truncate--></code> tag is found, then all text up 250 chacters are used.</p>
|
||||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="navigation.html">← Navigation and Sidebars</a><a class="docs-next button" href="translation.html">Translations & Localization →</a></div></div></div></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div><h5>Docs</h5><a href="
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<li><a href="/docs/en/commands.html#docusaurus-start-port-number"><code>yarn run start</code></a>: build and serve the website from a local server</li>
|
||||
<li><a href="/docs/en/commands.html#docusaurus-examples"><code>yarn run examples</code></a>: create example configuration files</li>
|
||||
</ul>
|
||||
<h2><a class="anchor" name="running-from-the-command-line"></a>Running from the command line <a class="hash-link" href="#running-from-the-command-line">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="running-from-the-command-line"></a><a href="#running-from-the-command-line" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Running from the command line</h2>
|
||||
<p>The scripts can be run using either Yarn or npm. If you've already gone through our Getting Started guide, you may already be familiar with the <code>start</code> command. It's the command that tells Docusaurus to run the <code>docusaurus-start</code> script which generates the site and starts up a server, and it's usually invoked like so:</p>
|
||||
<pre><code class="hljs">yarn <span class="hljs-keyword">run</span><span class="bash"> start
|
||||
</span></code></pre>
|
||||
|
@ -17,17 +17,17 @@
|
|||
<pre><code class="hljs">npm <span class="hljs-keyword">run</span><span class="bash"> start
|
||||
</span></code></pre>
|
||||
<p>To run a particular script, just replace the <code>start</code> command in the examples above with the command associated with your script.</p>
|
||||
<h2><a class="anchor" name="using-arguments"></a>Using arguments <a class="hash-link" href="#using-arguments">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="using-arguments"></a><a href="#using-arguments" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Using arguments</h2>
|
||||
<p>Some commands support optional arguments. For example, to start a server on port 8080, you can specify the <code>--port</code> argument when running <code>start</code>:</p>
|
||||
<pre><code class="hljs">yarn <span class="hljs-keyword">run</span><span class="bash"> start --port 8080
|
||||
</span></code></pre>
|
||||
<p>If you run Docusaurus using npm, you can still use the command line arguments by inserting a <code>--</code> between <code>npm run <command></code> and the command arguments:</p>
|
||||
<pre><code class="hljs">npm <span class="hljs-keyword">run</span><span class="bash"> start -- --port 8080
|
||||
</span></code></pre>
|
||||
<h2><a class="anchor" name="configuration"></a>Configuration <a class="hash-link" href="#configuration">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="configuration"></a><a href="#configuration" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Configuration</h2>
|
||||
<p>These scripts are set up under the <code>"scripts"</code> key in your <code>website/package.json</code> file as part of the installation process. If you need help setting them up again, please refer to the <a href="/docs/en/installation.html">Installation guide</a>.</p>
|
||||
<p>Docusaurus provides some default mappings to allow you to run commands following Node conventions. Instead of typing <code>docusaurus-start</code> every time, you can type <code>yarn run start</code> or <code>npm start</code> to achieve the same.</p>
|
||||
<h2><a class="anchor" name="commands"></a>Commands <a class="hash-link" href="#commands">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="commands"></a><a href="#commands" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Commands</h2>
|
||||
<ul>
|
||||
<li><a href="#docusaurus-build"><code>docusaurus-build</code></a></li>
|
||||
<li><a href="#docusaurus-examples-feature"><code>docusaurus-examples [feature]</code></a></li>
|
||||
|
@ -38,17 +38,17 @@
|
|||
<li><a href="#docusaurus-write-translations"><code>docusaurus-write-translations</code></a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2><a class="anchor" name="reference"></a>Reference <a class="hash-link" href="#reference">#</a></h2>
|
||||
<h3><a class="anchor" name="docusaurus-build"></a><code>docusaurus-build</code> <a class="hash-link" href="#docusaurus-build">#</a></h3>
|
||||
<h2><a class="anchor" aria-hidden="true" name="reference"></a><a href="#reference" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Reference</h2>
|
||||
<h3><a class="anchor" aria-hidden="true" name="docusaurus-build"></a><a href="#docusaurus-build" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>docusaurus-build</code></h3>
|
||||
<p>Alias: <code>build</code>.</p>
|
||||
<p>Generates the static website, applying translations if necessary. Useful for building the website prior to deployment.</p>
|
||||
<p>See also <a href="/docs/en/commands.html#docusaurus-start-port-number"><code>docusaurus-start</code></a>.</p>
|
||||
<hr>
|
||||
<h3><a class="anchor" name="docusaurus-examples-feature"></a><code>docusaurus-examples [feature]</code> <a class="hash-link" href="#docusaurus-examples-feature">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="docusaurus-examples-feature"></a><a href="#docusaurus-examples-feature" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>docusaurus-examples [feature]</code></h3>
|
||||
<p>Alias: <code>examples</code></p>
|
||||
<p>When no feature is specified, sets up a minimally configured example website in your project. This command is covered in depth in the <a href="/docs/en/site-preparation.html">Site Preparation guide</a>. Specify a feature <code>translations</code> or <code>versions</code> to generate the extra example files for that feature.</p>
|
||||
<hr>
|
||||
<h3><a class="anchor" name="docusaurus-publish"></a><code>docusaurus-publish</code> <a class="hash-link" href="#docusaurus-publish">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="docusaurus-publish"></a><a href="#docusaurus-publish" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>docusaurus-publish</code></h3>
|
||||
<p>Alias: <code>publish-gh-pages</code></p>
|
||||
<p><a href="/docs/en/commands.html#docusaurus-build">Builds</a>, then deploys the static website to GitHub Pages. This command is meant to be run during the deployment step in Circle CI, and therefore expects a few environment variables to be defined:</p>
|
||||
<ul>
|
||||
|
@ -60,21 +60,21 @@
|
|||
</ul>
|
||||
<p>You can learn more about configuring automatic deployments with CircleCI in the <a href="publishing.md">Publishing guide</a>.</p>
|
||||
<hr>
|
||||
<h3><a class="anchor" name="docusaurus-rename-version-currentversion-newversion"></a><code>docusaurus-rename-version <currentVersion> <newVersion></code> <a class="hash-link" href="#docusaurus-rename-version-currentversion-newversion">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="docusaurus-rename-version-currentversion-newversion"></a><a href="#docusaurus-rename-version-currentversion-newversion" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>docusaurus-rename-version <currentVersion> <newVersion></code></h3>
|
||||
<p>Alias: <code>rename-version</code></p>
|
||||
<p>Renames an existing version of the docs to a new version name.</p>
|
||||
<p>See the <a href="/docs/en/versioning.html#renaming-existing-versions">Versioning guide</a> to learn more.</p>
|
||||
<hr>
|
||||
<h3><a class="anchor" name="docusaurus-start-port-number"></a><code>docusaurus-start [--port <number>]</code> <a class="hash-link" href="#docusaurus-start-port-number">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="docusaurus-start-port-number"></a><a href="#docusaurus-start-port-number" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>docusaurus-start [--port <number>]</code></h3>
|
||||
<p>Alias: <code>start</code>.</p>
|
||||
<p>This script will build the static website, apply translations if necessary, and then start a local server. The website will be served from port 3000 by default.</p>
|
||||
<hr>
|
||||
<h3><a class="anchor" name="docusaurus-version-version"></a><code>docusaurus-version <version></code> <a class="hash-link" href="#docusaurus-version-version">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="docusaurus-version-version"></a><a href="#docusaurus-version-version" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>docusaurus-version <version></code></h3>
|
||||
<p>Alias: <code>version</code></p>
|
||||
<p>Generates a new version of the docs. This will result in a new copy of your site being generated and stored in its own versioned folder. Useful for capturing snapshots of API docs that map to specific versions of your software. Accepts any string as a version number.</p>
|
||||
<p>See the <a href="/docs/en/versioning.html">Versioning guide</a> to learn more.</p>
|
||||
<hr>
|
||||
<h3><a class="anchor" name="docusaurus-write-translations"></a><code>docusaurus-write-translations</code> <a class="hash-link" href="#docusaurus-write-translations">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="docusaurus-write-translations"></a><a href="#docusaurus-write-translations" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a><code>docusaurus-write-translations</code></h3>
|
||||
<p>Alias: <code>write-translations</code></p>
|
||||
<p>Writes the English for any strings that need to be translated into an <code>website/i18n/en.json</code> file. The script will go through every file in <code>website/pages/en</code> and through the <code>siteConfig.js</code> file and other config files to fetch English strings that will then be translated on Crowdin. See the <a href="/docs/en/translation.html">Translation guide</a> to learn more.</p>
|
||||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="versioning.html">← Versioning</a><a class="docs-next button" href="api-pages.html">Pages and Styles →</a></div></div></div></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div><h5>Docs</h5><a href="
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
toggler.onclick = function() {
|
||||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/guides-custom-pages.md" target="_blank">Edit</a><h1>Custom Pages</h1></header><article><div><span><h2><a class="anchor" name="customizing-your-home-page"></a>Customizing Your Home Page <a class="hash-link" href="#customizing-your-home-page">#</a></h2>
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/guides-custom-pages.md" target="_blank">Edit</a><h1>Custom Pages</h1></header><article><div><span><h2><a class="anchor" aria-hidden="true" name="customizing-your-home-page"></a><a href="#customizing-your-home-page" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Customizing Your Home Page</h2>
|
||||
<p>The easiest way to get started customizing your home page is to use the <a href="/docs/en/site-creation.html">examples generated previously</a>. You can start your local server and go to <code>http://localhost:3000</code> to see what the example home page looks like. From there, edit the <code>website/pages/en/index.js</code> file and its various components to use the images and text you want for your project.</p>
|
||||
<h2><a class="anchor" name="adding-other-custom-pages"></a>Adding Other Custom Pages <a class="hash-link" href="#adding-other-custom-pages">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="adding-other-custom-pages"></a><a href="#adding-other-custom-pages" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Adding Other Custom Pages</h2>
|
||||
<p>Docusaurus provides some simple example pages (<code>index.js</code>, <code>users.js</code>, <code>help.js</code>), but of course you're also free to write your own pages however you want. It is strongly suggested that you at least have an index page, but none of the pages are mandatory to include. More information on how to use the provided components or include your own can be found <a href="/docs/en/api-pages.html">here</a>. Information on how to link to your different pages in the header navigation bar can be found <a href="/docs/en/navigation.html">here</a>.</p>
|
||||
<h2><a class="anchor" name="customizing-your-site-footer"></a>Customizing Your Site Footer <a class="hash-link" href="#customizing-your-site-footer">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="customizing-your-site-footer"></a><a href="#customizing-your-site-footer" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Customizing Your Site Footer</h2>
|
||||
<p>Starting from the example <code>core/Footer.js</code> file you <a href="/docs/en/site-creation.html">generated before</a>, edit the footer to include any links to pages on your site or elsewhere that you wish to have.</p>
|
||||
<p>The example provided has three columns with a footer image on the left and Facebook's open source logo and copyright at the bottom. If your project is not a Facebook open source project, remove the logo and copyright. Otherwise, feel free to get creative with your footer and make it look however you'd like!</p>
|
||||
<p>Some suggestions for links you may want to provide: documentation, API, Twitter, Discord, Facebook groups, Stack Overflow, GitHub, etc.</p>
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
toggler.onclick = function() {
|
||||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/api-doc-markdown.md" target="_blank">Edit</a><h1>Markdown Features</h1></header><article><div><span><h2><a class="anchor" name="markdown-headers"></a>Markdown Headers <a class="hash-link" href="#markdown-headers">#</a></h2>
|
||||
<h2><a class="anchor" name="documents"></a>Documents <a class="hash-link" href="#documents">#</a></h2>
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/api-doc-markdown.md" target="_blank">Edit</a><h1>Markdown Features</h1></header><article><div><span><h2><a class="anchor" aria-hidden="true" name="markdown-headers"></a><a href="#markdown-headers" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Markdown Headers</h2>
|
||||
<h3><a class="anchor" aria-hidden="true" name="documents"></a><a href="#documents" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Documents</h3>
|
||||
<p>Documents use the following markdown header fields that are enclosed by a line <code>---</code> on either side:</p>
|
||||
<p><code>id</code>: A unique document id. If this field is not present, the document's <code>id</code> will default to it's file name (without the extension).</p>
|
||||
<p><code>title</code>: The title of your document. If this field is not present, the document's <code>title</code> will default to it's <code>id</code>.</p>
|
||||
|
@ -26,7 +26,7 @@ sidebar_label: Document
|
|||
<span class="hljs-section">original_id: doc1
|
||||
---</span>
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="blog-posts"></a>Blog Posts <a class="hash-link" href="#blog-posts">#</a></h2>
|
||||
<h3><a class="anchor" aria-hidden="true" name="blog-posts"></a><a href="#blog-posts" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Blog Posts</h3>
|
||||
<p>Blog Posts use the following markdown header fields that are enclosed by a line <code>---</code> on either side:</p>
|
||||
<p><code>title</code>: The title of this blog post.</p>
|
||||
<p><code>author</code>: The author of this blog post. If this field is omitted, no author name will be shown.</p>
|
||||
|
@ -40,21 +40,21 @@ authorURL: http://twitter.com/franchementli
|
|||
<span class="hljs-section">authorFBID: 100002976521003
|
||||
---</span>
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="extra-features"></a>Extra Features <a class="hash-link" href="#extra-features">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="extra-features"></a><a href="#extra-features" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Extra Features</h2>
|
||||
<p>Docusaurus supports some extra features when writing documentation in markdown.</p>
|
||||
<h2><a class="anchor" name="linking-other-documents"></a>Linking other Documents <a class="hash-link" href="#linking-other-documents">#</a></h2>
|
||||
<h3><a class="anchor" aria-hidden="true" name="linking-other-documents"></a><a href="#linking-other-documents" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Linking other Documents</h3>
|
||||
<p>You can use relative urls to other documentation files which will automatically get converted to the corresponding html links when they get rendered.</p>
|
||||
<p>Example:</p>
|
||||
<pre><code class="hljs css markdown">[<span class="hljs-string">This links to another document</span>](<span class="hljs-link">other-document.md</span>)
|
||||
</code></pre>
|
||||
<p>This markdown will automatically get converted into a link to <code>/docs/other-document.html</code> (or the appropriately translated/versioned link) once it gets rendered.</p>
|
||||
<p>This can help when you want to navigate through docs on GitHub since the links there will be functional links to other documents (still on GitHub), but the documents will have the correct html links when they get rendered.</p>
|
||||
<h2><a class="anchor" name="linking-to-images-and-other-assets"></a>Linking to Images and Other Assets <a class="hash-link" href="#linking-to-images-and-other-assets">#</a></h2>
|
||||
<h3><a class="anchor" aria-hidden="true" name="linking-to-images-and-other-assets"></a><a href="#linking-to-images-and-other-assets" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Linking to Images and Other Assets</h3>
|
||||
<p>Static assets can be linked to in the same way that documents are, using relative urls. Static assets used in documents and blogs should go into <code>docs/assets</code> and <code>website/blog/assets</code>, respectively. The markdown will get converted into correct link paths so that these paths will work for documents of all languages and versions.</p>
|
||||
<p>Example:</p>
|
||||
<pre><code class="hljs css markdown">
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="generating-table-of-contents"></a>Generating Table of Contents <a class="hash-link" href="#generating-table-of-contents">#</a></h2>
|
||||
<h3><a class="anchor" aria-hidden="true" name="generating-table-of-contents"></a><a href="#generating-table-of-contents" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Generating Table of Contents</h3>
|
||||
<p>You can make an autogenerated list of links, which can be useful as a table of contents for API docs.</p>
|
||||
<p>In your markdown file, insert a line with the text <<code>AUTOGENERATED_TABLE_OF_CONTENTS</code>>. Write your documentation using <code>h3</code> headers for each function inside a code block. These will be found by Docusaurus and a list of links to these sections will inserted at the text <<code>AUTOGENERATED_TABLE_OF_CONTENTS</code>>.</p>
|
||||
<p>Example:</p>
|
||||
|
@ -72,7 +72,7 @@ Text describing my function
|
|||
<span class="hljs-bullet">- </span><span class="hljs-code">`docdoc(file)`</span>
|
||||
</code></pre>
|
||||
<p>and each function will link to their corresponding sections in the page.</p>
|
||||
<h2><a class="anchor" name="syntax-highlighting"></a>Syntax Highlighting <a class="hash-link" href="#syntax-highlighting">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="syntax-highlighting"></a><a href="#syntax-highlighting" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Syntax Highlighting</h2>
|
||||
<p>Syntax highlighting is enabled by default on fenced code blocks. The language should be detected automatically, but you can sometimes get better results by specifying the language. You can do so using an <a href="https://github.github.com/gfm/#example-111">info string</a>, following the three opening backticks. The following JavaScript example...</p>
|
||||
<pre><code class="hljs">```javascript
|
||||
ReactDOM.render(
|
||||
|
@ -93,7 +93,7 @@ ReactDOM.render(
|
|||
}
|
||||
</code></pre>
|
||||
<p>You can find the full list of supported themes in the Highlight.js <a href="https://github.com/isagalaev/highlight.js/tree/master/src/styles"><code>styles</code></a> directory.</p>
|
||||
<h3><a class="anchor" name="registering-additional-languages"></a>Registering additional languages <a class="hash-link" href="#registering-additional-languages">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="registering-additional-languages"></a><a href="#registering-additional-languages" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Registering additional languages</h3>
|
||||
<p>While Highlight.js provides support for <a href="https://highlightjs.org/static/demo/">many popular languages out of the box</a>, you may find the need to register additional language support. For these cases, we provide an escape valve by exposing the <code>hljs</code> constant as part of the <code>highlight</code> config key. This in turn allows you to call <a href="http://highlightjs.readthedocs.io/en/latest/api.html#registerlanguage-name-language"><code>registerLanguage</code></a>:</p>
|
||||
<pre><code class="hljs css javascript">highlight: {
|
||||
<span class="hljs-attr">theme</span>: <span class="hljs-string">'default'</span>,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
toggler.onclick = function() {
|
||||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/guides-navigation.md" target="_blank">Edit</a><h1>Navigation and Sidebars</h1></header><article><div><span><h2><a class="anchor" name="new-hidden-docs"></a>New Hidden Docs <a class="hash-link" href="#new-hidden-docs">#</a></h2>
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/guides-navigation.md" target="_blank">Edit</a><h1>Navigation and Sidebars</h1></header><article><div><span><h2><a class="anchor" aria-hidden="true" name="new-hidden-docs"></a><a href="#new-hidden-docs" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>New Hidden Docs</h2>
|
||||
<p>New markdown files within <code>docs</code> will show up as pages on the website. Creating a file such as "docs/getting-started.md" will enable the new page <code>/docs/getting-started.html</code>.</p>
|
||||
<p>To change the id (link name) of the file, set the <code>id</code> field in the markdown header. At the top of <code>getting-started.md</code>:</p>
|
||||
<pre><code class="hljs"><span class="hljs-meta">---</span>
|
||||
|
@ -15,7 +15,7 @@
|
|||
<span class="hljs-string">My</span> <span class="hljs-meta">*new</span> <span class="hljs-string">content*</span> <span class="hljs-string">here..</span>
|
||||
</code></pre>
|
||||
<p>Now, the doc can be accessed from <code>/docs/intro.html</code>.</p>
|
||||
<h2><a class="anchor" name="adding-docs-to-a-sidebar"></a>Adding Docs to a Sidebar <a class="hash-link" href="#adding-docs-to-a-sidebar">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="adding-docs-to-a-sidebar"></a><a href="#adding-docs-to-a-sidebar" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Adding Docs to a Sidebar</h2>
|
||||
<p>Now we want our new page to show up on the sidebar. We configure the order of the sidebar in <code>website/sidebars.json</code>.</p>
|
||||
<p>Within <code>sidebars.json</code>, add the doc ID within an existing sidebar/category:</p>
|
||||
<pre><code class="hljs">{
|
||||
|
@ -32,7 +32,7 @@
|
|||
],
|
||||
...
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="new-hidden-sections"></a>New Hidden Sections <a class="hash-link" href="#new-hidden-sections">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="new-hidden-sections"></a><a href="#new-hidden-sections" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>New Hidden Sections</h2>
|
||||
<p>You can also put the doc in a new sidebar. In this case we are creating a <code>intro</code> section within <code>sidebars.json</code>.</p>
|
||||
<pre><code class="hljs">{
|
||||
<span class="hljs-string">"intro"</span>: {
|
||||
|
@ -43,7 +43,7 @@
|
|||
...
|
||||
</code></pre>
|
||||
<p>Keep in mind, until you add the section to the nav bar (below), this new "intro" section of the site will be hidden with no links going to it.</p>
|
||||
<h2><a class="anchor" name="adding-doc-to-site-nav-bar"></a>Adding doc to site nav bar <a class="hash-link" href="#adding-doc-to-site-nav-bar">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="adding-doc-to-site-nav-bar"></a><a href="#adding-doc-to-site-nav-bar" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Adding doc to site nav bar</h2>
|
||||
<p>After creating a new section of the site by adding to <code>sidebars.json</code>, you can link to the new doc from the top navigation bar by editing the <code>headerLinks</code> field of <code>siteConfig.js</code>.</p>
|
||||
<pre><code class="hljs">headerLinks: [
|
||||
...
|
||||
|
@ -51,7 +51,7 @@
|
|||
</span> ...
|
||||
],
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="custom-page-links-in-nav-bar"></a>Custom page links in nav bar <a class="hash-link" href="#custom-page-links-in-nav-bar">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="custom-page-links-in-nav-bar"></a><a href="#custom-page-links-in-nav-bar" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Custom page links in nav bar</h2>
|
||||
<p>To add custom pages to the navigation bar, entries can be added to the <code>headerLinks</code> of <code>siteConfig.js</code>. For example, if we have a page within <code>website/pages/help.js</code>, we can link to it by adding the following:</p>
|
||||
<pre><code class="hljs">headerLinks: [
|
||||
...
|
||||
|
@ -59,7 +59,7 @@
|
|||
</span> ...
|
||||
],
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="external-links-in-nav-bar"></a>External links in nav bar <a class="hash-link" href="#external-links-in-nav-bar">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="external-links-in-nav-bar"></a><a href="#external-links-in-nav-bar" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>External links in nav bar</h2>
|
||||
<p>Custom links can be added to the nav bar with the following entry in <code>siteConfig.js</code>:</p>
|
||||
<pre><code class="hljs">headerLinks: [
|
||||
...
|
||||
|
@ -68,7 +68,7 @@
|
|||
],
|
||||
</code></pre>
|
||||
<p>To open external links in a new tab, provide an <code>external: true</code> flag within the header link config.</p>
|
||||
<h2><a class="anchor" name="search-bar-position-in-nav-bar"></a>Search bar position in nav bar <a class="hash-link" href="#search-bar-position-in-nav-bar">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="search-bar-position-in-nav-bar"></a><a href="#search-bar-position-in-nav-bar" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Search bar position in nav bar</h2>
|
||||
<p>If search is enabled on your site, your search bar will appear to the right of your links. If you want to put the search bar between links in the header, add a search entry in the <code>headerLinks</code> config array:</p>
|
||||
<pre><code class="hljs"><span class="hljs-string">headerLinks:</span> [
|
||||
{ <span class="hljs-string">doc:</span> <span class="hljs-string">'foo'</span>, <span class="hljs-string">label:</span> <span class="hljs-string">'Foo'</span> },
|
||||
|
@ -76,7 +76,7 @@
|
|||
{ <span class="hljs-string">doc:</span> <span class="hljs-string">'bar'</span>, <span class="hljs-string">label:</span> <span class="hljs-string">'Bar'</span> },
|
||||
],
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="languages-dropdown-position-in-nav-bar"></a>Languages dropdown position in nav bar <a class="hash-link" href="#languages-dropdown-position-in-nav-bar">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="languages-dropdown-position-in-nav-bar"></a><a href="#languages-dropdown-position-in-nav-bar" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Languages dropdown position in nav bar</h2>
|
||||
<p>If translations is enabled on your site, the language dropdown will appear to the right of your links (and to the left of the search bar, if search is enabled). If you want to put the language selection drop down between links in the header, add a languages entry in the <code>headerLinks</code> config array:</p>
|
||||
<pre><code class="hljs"><span class="hljs-string">headerLinks:</span> [
|
||||
{ <span class="hljs-string">doc:</span> <span class="hljs-string">'foo'</span>, <span class="hljs-string">label:</span> <span class="hljs-string">'Foo'</span> },
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/getting-started-publishing.md" target="_blank">Edit</a><h1>Publishing your site</h1></header><article><div><span><p>You should now have a site up and running locally. Once you have customized it to your liking, it's time to publish it. Docusaurus generates a static HTML website that is ready to be served by your favorite web server or online hosting solution.</p>
|
||||
<h2><a class="anchor" name="building-static-html-pages"></a>Building Static HTML Pages <a class="hash-link" href="#building-static-html-pages">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="building-static-html-pages"></a><a href="#building-static-html-pages" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Building Static HTML Pages</h2>
|
||||
<p>To create a static build of your website, run the script:</p>
|
||||
<pre><code class="hljs">npm <span class="hljs-keyword">run</span><span class="bash"> build
|
||||
</span></code></pre>
|
||||
|
@ -13,9 +13,9 @@
|
|||
<pre><code class="hljs">yarn <span class="hljs-keyword">run</span><span class="bash"> build
|
||||
</span></code></pre>
|
||||
<p>This will generate <code>.html</code> files from all of your docs and other pages included in <code>pages</code>. The build folder is inside Docusaurus's directory inside <code>node_modules</code>.</p>
|
||||
<h2><a class="anchor" name="hosting-static-html-pages"></a>Hosting Static HTML Pages <a class="hash-link" href="#hosting-static-html-pages">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="hosting-static-html-pages"></a><a href="#hosting-static-html-pages" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Hosting Static HTML Pages</h2>
|
||||
<p>At this point, you can grab all of the files inside the <code>node_modules/docusaurus/build</code> folder and copy them over to your favorite web server's "html" directory. For example, both Apache and nginx serve content from <code>/var/www/html</code> by default. You'll still need to host the web server somewhere, and as it happens, choosing a web hosting provider is out of scope for this guide. Don't fret, as Docusaurus was designed to work really well with one of the most popular hosting solutions for open source projects: GitHub Pages.</p>
|
||||
<h3><a class="anchor" name="using-github-pages"></a>Using GitHub Pages <a class="hash-link" href="#using-github-pages">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="using-github-pages"></a><a href="#using-github-pages" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Using GitHub Pages</h3>
|
||||
<p>Deploying your Docusaurus site to GitHub Pages is straightforward if you are already using GitHub to host your project. Your code repository does not even need to be public. Most of the work is done for you automatically through the <a href="./commands.md#docusaurus-publish"><code>publish-gh-pages</code></a> script.</p>
|
||||
<p>Before you go ahead and do that, you need to determine the values for a few parameters required by the script. They are:</p>
|
||||
<ul>
|
||||
|
@ -33,9 +33,9 @@
|
|||
</code></pre>
|
||||
<p>You should now be able to load your website by visiting its GitHub Pages URL, which should be something along the lines of https://CIRCLE_PROJECT_USERNAME.github.io/CIRCLE_PROJECT_REPONAME. For example, Docusaurus's own GitHub Pages URL is https://facebookexperimental.github.io/docusaurus, because it is served from the <code>gh-pages</code> branch of the https://github.com/facebookexperimental/docusaurus GitHub repo. We highly encourage reading through the <a href="https://pages.github.com">GitHub Pages documentation</a> to learn more about how this hosting solution works.</p>
|
||||
<p>You can run the command above any time you update the docs and wish to deploy the changes to your site. That's usually fine for sites where the documentation rarely changes, where it's not too much of an inconvenience to remember to manually deploy changes. Now, if you're wondering if this process can be automated in any way, keep reading...</p>
|
||||
<h2><a class="anchor" name="automating-deployments-using-continuous-integration"></a>Automating Deployments Using Continuous Integration <a class="hash-link" href="#automating-deployments-using-continuous-integration">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="automating-deployments-using-continuous-integration"></a><a href="#automating-deployments-using-continuous-integration" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Automating Deployments Using Continuous Integration</h2>
|
||||
<p>Continuous integration services are typically used to perform routine tasks whenever new commits are checked in to source control. These tasks can be any combination of running unit tests and integration tests, automating builds, publishing packages to NPM, and yes, deploying changes to your website. All you need to do to automate deployment of your website is to invoke the <code>publish-gh-pages</code> script whenever your docs get updated. In the following section we'll be covering how to do just that using Circle CI, a popular continuous integration service provider.</p>
|
||||
<h3><a class="anchor" name="using-circle-ci"></a>Using Circle CI <a class="hash-link" href="#using-circle-ci">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="using-circle-ci"></a><a href="#using-circle-ci" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Using Circle CI</h3>
|
||||
<p>If you're already using Circle CI for your project, all you need to do to enable automatic deployments is to configure Circle to run the <code>publish-gh-pages</code> script as part of the deployment step.</p>
|
||||
<ol>
|
||||
<li>Go to https://github.com/settings/tokens and generate a new token, granting it full control of private repositories through the <code>repo</code> access scope. Store this token in a safe place, making sure to not share it with anyone. This token can be used to authenticate GitHub actions on your behalf in place of your GitHub password.</li>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/guides-search.md" target="_blank">Edit</a><h1>Enabling Search</h1></header><article><div><span><p>Docusaurus supports search using <a href="https://community.algolia.com/docsearch/">Algolia DocSearch</a>. Once you have set up your site, <a href="https://community.algolia.com/docsearch/">enter your site information</a> to have Algolia crawl your website's documentation pages. Algolia will then send you an API key and index name for your site.</p>
|
||||
<h3><a class="anchor" name="enabling-the-search-bar"></a>Enabling the Search Bar <a class="hash-link" href="#enabling-the-search-bar">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="enabling-the-search-bar"></a><a href="#enabling-the-search-bar" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Enabling the Search Bar</h3>
|
||||
<p>Enter your search-only API key and index name into <code>siteConfig.js</code> in the <code>algolia</code> section to enable search for your site.</p>
|
||||
<pre><code class="hljs css js"><span class="hljs-keyword">const</span> siteConfig = {
|
||||
...
|
||||
|
@ -16,7 +16,7 @@
|
|||
...
|
||||
}
|
||||
</code></pre>
|
||||
<h3><a class="anchor" name="extra-search-options"></a>Extra Search Options <a class="hash-link" href="#extra-search-options">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="extra-search-options"></a><a href="#extra-search-options" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Extra Search Options</h3>
|
||||
<p>You can also specify extra <a href="https://community.algolia.com/docsearch/documentation/">search options used by Algolia</a> by using an <code>algoliaOptions</code> field in <code>algolia</code>. This may be useful if you want to provide different search results for the different versions or languages of your docs. Any occurrences of "VERSION" or "LANGUAGE" will be replaced by the version or language of the current page, respectively. More details about search options can be <a href="https://www.algolia.com/doc/api-reference/api-parameters/#overview">found here</a>.</p>
|
||||
<pre><code class="hljs css js"><span class="hljs-keyword">const</span> siteConfig = {
|
||||
...
|
||||
|
@ -29,7 +29,7 @@
|
|||
},
|
||||
}
|
||||
</code></pre>
|
||||
<h3><a class="anchor" name="controlling-the-location-of-the-search-bar"></a>Controlling the Location of the Search Bar <a class="hash-link" href="#controlling-the-location-of-the-search-bar">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="controlling-the-location-of-the-search-bar"></a><a href="#controlling-the-location-of-the-search-bar" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Controlling the Location of the Search Bar</h3>
|
||||
<p>By default, the search bar will be the rightmost element in the top navigation bar.</p>
|
||||
<p>If you want to change the default location, add the <code>searchBar</code> flag in the <code>headerLinks</code> field of <code>siteConfig.js</code> in your desired location. For example, you may want the search bar in between your internal and external links.</p>
|
||||
<pre><code class="hljs css js"><span class="hljs-keyword">const</span> siteConfig = {
|
||||
|
@ -44,7 +44,7 @@
|
|||
...
|
||||
}
|
||||
</code></pre>
|
||||
<h3><a class="anchor" name="disabling-the-search-bar"></a>Disabling the Search Bar <a class="hash-link" href="#disabling-the-search-bar">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="disabling-the-search-bar"></a><a href="#disabling-the-search-bar" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Disabling the Search Bar</h3>
|
||||
<p>To disable the search bar, comment out (recommended) or delete the <code>algolia</code> section in the <code>siteConfig.js</code> file.</p>
|
||||
<p>Also, if you have customized the location of the search bar in <code>headerLinks</code>, set <code>search: false</code>.</p>
|
||||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="translation.html">← Translations & Localization</a><a class="docs-next button" href="versioning.html">Versioning →</a></div></div></div></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div><h5>Docs</h5><a href="
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/api-site-config.md" target="_blank">Edit</a><h1>siteConfig.js</h1></header><article><div><span><p>A large part of site configuration is done by editing the <code>siteConfig.js</code> file.</p>
|
||||
<h2><a class="anchor" name="user-showcase"></a>User Showcase <a class="hash-link" href="#user-showcase">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="user-showcase"></a><a href="#user-showcase" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>User Showcase</h2>
|
||||
<p>The <code>users</code> array is used to store objects for each project/user that you want to show on your site. Currently this field is used by example the <code>pages/en/index.js</code> and <code>pages/en/users.js</code> files provided. Each user object should have <code>caption</code>, <code>image</code>, <code>infoLink</code>, and <code>pinned</code> fields. The <code>caption</code> is the text showed when someone hovers over the <code>image</code> of that user, and the <code>infoLink</code> is where clicking the image will bring someon. The <code>pinned</code> field determines whether or not it shows up on the <code>index</code> page.</p>
|
||||
<p>Currently this <code>users</code> array is used only by the <code>index.js</code> and <code>users.js</code> example files. If you do not wish to have a users page or show users on the <code>index</code> page, you may remove this section.</p>
|
||||
<h2><a class="anchor" name="siteconfig-fields"></a>siteConfig Fields <a class="hash-link" href="#siteconfig-fields">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="siteconfig-fields"></a><a href="#siteconfig-fields" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>siteConfig Fields</h2>
|
||||
<p>The <code>siteConfig</code> object contains the bulk of the configuration settings for your website.</p>
|
||||
<h3><a class="anchor" name="mandatory-fields"></a>Mandatory Fields <a class="hash-link" href="#mandatory-fields">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="mandatory-fields"></a><a href="#mandatory-fields" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Mandatory Fields</h3>
|
||||
<p><code>title</code> - Title for your website.</p>
|
||||
<p><code>tagline</code> - Tagline for your website.</p>
|
||||
<p><code>url</code> - url for your site.</p>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<li>Custom color configurations can also be added. For example, if user styles are added with colors specified as <code>$myColor</code>, then adding a <code>myColor</code> field to <code>colors</code> will allow you to easily configure this color.</li>
|
||||
</ul>
|
||||
<p><code>copyright</code> - The copyright string at footer of site and within feed</p>
|
||||
<h3><a class="anchor" name="optional-fields"></a>Optional Fields <a class="hash-link" href="#optional-fields">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="optional-fields"></a><a href="#optional-fields" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Optional Fields</h3>
|
||||
<p><code>editUrl</code> - url for editing docs, usage example: <code>editUrl + 'en/doc1.md'</code>. If this field is omitted, there will be no "Edit this Doc" button for each document.</p>
|
||||
<p><code>users</code> - The <code>users</code> array mentioned earlier.</p>
|
||||
<p><code>disableHeaderTitle</code> - An option to disable showing the title in the header next to the header icon. Exclude this field to keep the header as normal, otherwise set to <code>true</code>.</p>
|
||||
|
@ -62,7 +62,7 @@
|
|||
<p><code>markdownPlugins</code> - An array of plugins to be loaded by Remarkable, the markdown parser and renderer used by Docusaurus. The plugin will receive a reference to the Remarkable instance, allowing custom parsing and rendering rules to be defined.</p>
|
||||
<p><code>scripts</code> - Array of JavaScript sources to load. The script tag will be inserted in the HTML head.</p>
|
||||
<p>Users can also add their own custom fields if they wish to provide some data across different files.</p>
|
||||
<h2><a class="anchor" name="example-siteconfigjs-with-all-fields"></a>Example siteConfig.js with all fields <a class="hash-link" href="#example-siteconfigjs-with-all-fields">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="example-siteconfigjs-with-all-fields"></a><a href="#example-siteconfigjs-with-all-fields" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Example siteConfig.js with all fields</h2>
|
||||
<pre><code class="hljs"><span class="hljs-string">const</span> <span class="hljs-string">users</span> <span class="hljs-string">=</span> <span class="hljs-string">[</span>
|
||||
<span class="hljs-string">{</span>
|
||||
<span class="hljs-attr"> caption:</span> <span class="hljs-string">"User1"</span><span class="hljs-string">,</span>
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/getting-started-site-creation.md" target="_blank">Edit</a><h1>Creating your site</h1></header><article><div><span><p>Docusaurus' primary purpose of existence is to make it super simple for you to create documentation for your project and have a site to house those docs.</p>
|
||||
<p>After <a href="/docs/en/installation.html">installation</a> and <a href="/docs/en/site-preparation.html">preparation</a>, much of the work to create a basic site for your docs is already complete.</p>
|
||||
<h2><a class="anchor" name="load-the-example-site"></a>Load the Example Site <a class="hash-link" href="#load-the-example-site">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="load-the-example-site"></a><a href="#load-the-example-site" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Load the Example Site</h2>
|
||||
<p><a href="/docs/en/site-preparation.html">Preparation</a> created a sample site for you to see Docusaurus in action. However, it also provided the infrastructure that will be used as you are developing your own site.</p>
|
||||
<h2><a class="anchor" name="site-structure"></a>Site Structure <a class="hash-link" href="#site-structure">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="site-structure"></a><a href="#site-structure" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Site Structure</h2>
|
||||
<p>After loading the example site, you should see a structure in your repo that looks similar to:</p>
|
||||
<pre><code class="hljs">project-repo/
|
||||
docs/
|
||||
|
@ -21,7 +21,7 @@
|
|||
<blockquote>
|
||||
<p>The blog posts must be formatted as yyyy-mm-dd-your-file-name.md</p>
|
||||
</blockquote>
|
||||
<h2><a class="anchor" name="create-your-basic-site"></a>Create Your Basic Site <a class="hash-link" href="#create-your-basic-site">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="create-your-basic-site"></a><a href="#create-your-basic-site" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Create Your Basic Site</h2>
|
||||
<p>To create a fully functional site, you only need to do a few steps:</p>
|
||||
<ol>
|
||||
<li>Add your documentation to the <code>/docs</code> folder as <code>.md</code> files, ensuring you have the proper <a href="/docs/en/doc-markdown.html">header</a> in each file.</li>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<li>Verifying that Docusaurus was installed correctly.</li>
|
||||
<li>Providing you the skeleton to create your site.</li>
|
||||
</ol>
|
||||
<h2><a class="anchor" name="verifying-installation"></a>Verifying Installation <a class="hash-link" href="#verifying-installation">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="verifying-installation"></a><a href="#verifying-installation" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Verifying Installation</h2>
|
||||
<ol>
|
||||
<li><p>Generate the files for the example site by running <code>examples</code> using <code>yarn</code> or <code>npm</code>.</p>
|
||||
<pre><code class="hljs">npm <span class="hljs-keyword">run</span><span class="bash"> examples
|
||||
|
@ -28,7 +28,7 @@
|
|||
</span></code></pre></li>
|
||||
<li><p>Load the example site at http://localhost:3000. You should see the example site loaded in your web browser.</p></li>
|
||||
</ol>
|
||||
<h2><a class="anchor" name="example-site-configuration"></a>Example Site Configuration <a class="hash-link" href="#example-site-configuration">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="example-site-configuration"></a><a href="#example-site-configuration" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Example Site Configuration</h2>
|
||||
<p>Loading the example site will create the following files/folders:</p>
|
||||
<pre><code class="hljs">website/core/Footer.js
|
||||
website/pages/...
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/guides-translation.md" target="_blank">Edit</a><h1>Translations & Localization</h1></header><article><div><span><p>Docusaurus allows for easy translation functionality using Crowdin. Documentation files written in English are uploaded to Crowdin for translation by users within a community. Top-level pages written with English strings can be translated by wrapping any strings you want to translate in a <code><translate></code> tag. Other titles and labels will also be found and properly translated.</p>
|
||||
<h2><a class="anchor" name="docusaurus-translation-configurations"></a>Docusaurus Translation Configurations <a class="hash-link" href="#docusaurus-translation-configurations">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="docusaurus-translation-configurations"></a><a href="#docusaurus-translation-configurations" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Docusaurus Translation Configurations</h2>
|
||||
<p>To generate example files for translations with Docusuaurus, run the <code>examples</code> script with the command line argument <code>translations</code>:</p>
|
||||
<pre><code class="hljs">npm <span class="hljs-keyword">run</span><span class="bash"> examples translations
|
||||
</span></code></pre>
|
||||
|
@ -20,9 +20,9 @@ crowdin<span class="hljs-selector-class">.yaml</span>
|
|||
<p>The <code>pages/en/help-with-translations.js</code> file includes the same starter help page generated by the <code>examples</code> script, but now includes translation tags.</p>
|
||||
<p>The <code>languages.js</code> file tells Docusaurus what languages you want to enable for your site. By default, we expect English to be enabled.</p>
|
||||
<p>The <code>crowdin.yaml</code> file is used to configure crowdin integration, and is copied up one level into your docusaurus project repo. If your docusaurus project resides in <code>/project/website</code>, then <code>crowdin.yaml</code> will be copied to <code>/project/crowdin.yaml</code>.</p>
|
||||
<h2><a class="anchor" name="translating-your-existing-docs"></a>Translating Your Existing Docs <a class="hash-link" href="#translating-your-existing-docs">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="translating-your-existing-docs"></a><a href="#translating-your-existing-docs" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Translating Your Existing Docs</h2>
|
||||
<p>Your documentation files do not need to be changed or moved to support translations. They will be uploaded to Crowdin to be translated directly.</p>
|
||||
<h2><a class="anchor" name="enabling-translations-on-pages"></a>Enabling Translations on Pages <a class="hash-link" href="#enabling-translations-on-pages">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="enabling-translations-on-pages"></a><a href="#enabling-translations-on-pages" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Enabling Translations on Pages</h2>
|
||||
<p>Pages allow you to customize layout and specific content of pages like a custom index page or help page.</p>
|
||||
<p>Pages with text that you want translated should be placed in <code>website/pages/en</code> folder.</p>
|
||||
<p>Wrap strings you want translated in a <code><translate></code> tag, and add the following <code>require</code> statement to the top of the file:</p>
|
||||
|
@ -39,7 +39,7 @@ const translate = require("../../server/translate.js").translate;
|
|||
<span class="xml"><span class="hljs-tag"><<span class="hljs-name">translate</span> <span class="hljs-attr">desc</span>=<span class="hljs-string">"flower, not verb"</span>></span>Rose<span class="hljs-tag"></<span class="hljs-name">translate</span>></span></span>
|
||||
<p>
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="gathering-strings-to-translate"></a>Gathering Strings to Translate <a class="hash-link" href="#gathering-strings-to-translate">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="gathering-strings-to-translate"></a><a href="#gathering-strings-to-translate" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Gathering Strings to Translate</h2>
|
||||
<p>The strings within localized Pages must be extracted and provided to Crowdin.</p>
|
||||
<p>Add the following script to your package.json file:</p>
|
||||
<pre><code class="hljs css json">...
|
||||
|
@ -57,18 +57,18 @@ const translate = require("../../server/translate.js").translate;
|
|||
<li>header link <code>label</code> strings in <code>siteConfig.js</code></li>
|
||||
<li>strings wrapped in the <code><translate></code> tag in any <code>.js</code> files inside <code>pages</code></li>
|
||||
</ul>
|
||||
<h2><a class="anchor" name="how-strings-get-translated"></a>How Strings Get Translated <a class="hash-link" href="#how-strings-get-translated">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="how-strings-get-translated"></a><a href="#how-strings-get-translated" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How Strings Get Translated</h2>
|
||||
<p>Docusaurus itself does not do any translation from one language to another. Instead, it integrates <a href="https://crowdin.com/">Crowdin</a> to upload translations and then downloads the appropriately translated files from Crowdin.</p>
|
||||
<h2><a class="anchor" name="how-docusaurus-uses-string-translations"></a>How Docusaurus Uses String Translations <a class="hash-link" href="#how-docusaurus-uses-string-translations">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="how-docusaurus-uses-string-translations"></a><a href="#how-docusaurus-uses-string-translations" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How Docusaurus Uses String Translations</h2>
|
||||
<p>This section provides context about how translations in Docusaurus works.</p>
|
||||
<h3><a class="anchor" name="strings"></a>Strings <a class="hash-link" href="#strings">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="strings"></a><a href="#strings" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Strings</h3>
|
||||
<p>A Docusaurus site has many strings used throughout it that require localization. However, maintaining a list of strings used through out a site can be laborious. Docusaurus simplifies this by centralizing strings.</p>
|
||||
<p>The header navigation, for example can have links to 'Home' or your 'Blog'. This and other strings found in the headers and sidebars of pages are extracted and placed into <code>i18n/en.json</code>. When your files are translated, say into Spanish, a <code>i18n/es-ES.json</code> file will be downloaded from Crowdin. Then, when the Spanish pages are generated, Docusaurus will replace the English version of corresponding strings with translated strings from the corresponding localized strings file (e.g. In a Spanish enabled site 'Help' will become 'Ayuda').</p>
|
||||
<h3><a class="anchor" name="markdown-files"></a>Markdown Files <a class="hash-link" href="#markdown-files">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="markdown-files"></a><a href="#markdown-files" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Markdown Files</h3>
|
||||
<p>For documentation files themselves, translated versions of these files are downloaded and then rendered through the proper layout template.</p>
|
||||
<h3><a class="anchor" name="other-pages"></a>Other Pages <a class="hash-link" href="#other-pages">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="other-pages"></a><a href="#other-pages" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Other Pages</h3>
|
||||
<p>For other pages, Docusaurus will automatically transform all <code><translate></code> tags it finds into function calls that return the translated strings from the corresponding localized file <em><code>locale.json</code></em>.</p>
|
||||
<h2><a class="anchor" name="crowdin"></a>Crowdin <a class="hash-link" href="#crowdin">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="crowdin"></a><a href="#crowdin" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Crowdin</h2>
|
||||
<p>Crowdin is a company that provides translation services. For Open Source projects, Crowdin provides free string translations</p>
|
||||
<p>Create your translation project on <a href="https://www.crowdin.com/">Crowdin</a>. You can use <a href="https://support.crowdin.com/translation-process-overview/">Crowdin's guides</a> to learn more about the translations work flow. <em>We suggest that you deselect and do not include "English" as a translateable language to prevent the creation of <code>en-US</code> localization files as this can lead to confusion.</em></p>
|
||||
<p>Your project will need a <code>crowdin.yaml</code> file generated.</p>
|
||||
|
@ -99,7 +99,7 @@ const translate = require("../../server/translate.js").translate;
|
|||
<span class="hljs-attr"> 'zh-TW':</span> <span class="hljs-string">'zh-Hant'</span>
|
||||
</code></pre>
|
||||
<p>You can go <a href="https://support.crowdin.com/configuration-file/">here</a> to learn more about customizing your <code>crowdin.yaml</code> file.</p>
|
||||
<h3><a class="anchor" name="manual-file-sync"></a>Manual File Sync <a class="hash-link" href="#manual-file-sync">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="manual-file-sync"></a><a href="#manual-file-sync" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Manual File Sync</h3>
|
||||
<p>You will want to manually sync your files to and from crowdin. The sync process will upload any markdown files in <code>/docs</code> as well as translatable strings in <code>website/i18n/en.json</code>. (These strings can be generated by running <code>yarn write-translations</code>.)</p>
|
||||
<p>You can add the following to your <code>package.json</code> to manually trigger crowdin.</p>
|
||||
<pre><code class="hljs css json">"scripts": {
|
||||
|
@ -111,7 +111,7 @@ const translate = require("../../server/translate.js").translate;
|
|||
</code></pre>
|
||||
<p>These commands require having an environment variable set with your crowdin project id and api key (<code>CROWDIN_PROJECT_ID</code>, <code>CROWDIN_API_KEY</code>). You can add them inline like above or add them permanently to your <code>.bashrc</code> or <code>.bash_profile</code>.</p>
|
||||
<p>If you run more than one localized Docusaurus project on your computer, you should change the name of the enviroment variables to something unique (<code>CROWDIN_PROJECTNAME_PROJECT_ID</code>, <code>CROWDIN_PROJECTNAME_API_KEY</code>).</p>
|
||||
<h3><a class="anchor" name="automated-file-sync-using-circleci"></a>Automated File Sync Using CircleCI <a class="hash-link" href="#automated-file-sync-using-circleci">#</a></h3>
|
||||
<h3><a class="anchor" aria-hidden="true" name="automated-file-sync-using-circleci"></a><a href="#automated-file-sync-using-circleci" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Automated File Sync Using CircleCI</h3>
|
||||
<p>You can automate pulling down and uploading translations for your files using the <a href="https://circleci.com">CircleCI</a> web continuous integration service.</p>
|
||||
<p>First, update the <code>circle.yml</code> file in your project directory to include steps to upload English files to be translated and download translated files using the Crowdin CLI. Here is an example <code>circle.yml</code> file:</p>
|
||||
<pre><code class="hljs css yaml"><span class="hljs-attr">machine:</span>
|
||||
|
@ -148,7 +148,7 @@ const translate = require("../../server/translate.js").translate;
|
|||
<p>Note that in the <code>crowdin.yaml</code> file, <code>CROWDIN_PROJECT_ID</code> and <code>CROWDIN_API_KEY</code> are environment variables set-up in Circle for your Crowdin project. They can be found in your Crowdin project settings.</p>
|
||||
<p>Now, Circle will help you automatically get translations prior to building your website. The provided <code>crowdin.yaml</code> file will copy translated documents into <code>website/translated_docs/</code>, and translated versions of the <code>i18n/en.json</code> strings file will into <code>i18n/${language}.json</code>.</p>
|
||||
<p>If you wish to use Crowdin on your machine locally, you can install the <a href="https://support.crowdin.com/cli-tool/">Crowdin CLI tool</a> and run the same commands found in the <code>circle.yaml</code> file. The only difference is that you must set <code>project_identifier</code> and <code>api_key</code> values in the <code>crowdin.yaml</code> file since you will not have Circle environment variables set up.</p>
|
||||
<h2><a class="anchor" name="versioned-translations"></a>Versioned Translations <a class="hash-link" href="#versioned-translations">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="versioned-translations"></a><a href="#versioned-translations" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Versioned Translations</h2>
|
||||
<p>TODO - This section needs to be fleshed out.</p>
|
||||
<p>OLD -</p>
|
||||
<p>If you wish to have translation and versioning for your documentation, add the following section to the end of your <code>crowdin.yaml</code> file:</p>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
nav.classList.toggle('docsSliderActive');
|
||||
};
|
||||
</script></nav></div><div class="container mainContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/facebookexperimental/docusaurus/edit/master/docs/guides-versioning.md" target="_blank">Edit</a><h1>Versioning</h1></header><article><div><span><p>Users 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>
|
||||
<h2><a class="anchor" name="how-to-create-new-versions"></a>How to Create New Versions <a class="hash-link" href="#how-to-create-new-versions">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="how-to-create-new-versions"></a><a href="#how-to-create-new-versions" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>How to Create New Versions</h2>
|
||||
<p>Add the following script to your <code>package.json</code> file:</p>
|
||||
<pre><code class="hljs css json">...
|
||||
"scripts": {
|
||||
|
@ -20,18 +20,18 @@
|
|||
<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, and the site will display the version number next to the title in the header.</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>npm 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>
|
||||
<h2><a class="anchor" name="versioning-patterns"></a>Versioning Patterns <a class="hash-link" href="#versioning-patterns">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="versioning-patterns"></a><a href="#versioning-patterns" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Versioning Patterns</h2>
|
||||
<p>Users can create version numbers in whatever format they 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>
|
||||
<h2><a class="anchor" name="storing-files-for-each-version"></a>Storing Files for Each Version <a class="hash-link" href="#storing-files-for-each-version">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="storing-files-for-each-version"></a><a href="#storing-files-for-each-version" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Storing Files for Each Version</h2>
|
||||
<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 appending <code>"version-${version}-"</code> to the id and by adding an <code>original_id</code> field.</p>
|
||||
<p>Versioned sidebars are copied into <code>website/versioned_sidebars</code> and are named as <code>version-${version}-sidebar.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>
|
||||
<h2><a class="anchor" name="fallback-functionality"></a>Fallback Functionality <a class="hash-link" href="#fallback-functionality">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="fallback-functionality"></a><a href="#fallback-functionality" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Fallback Functionality</h2>
|
||||
<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>
|
||||
<h2><a class="anchor" name="renaming-existing-versions"></a>Renaming Existing Versions <a class="hash-link" href="#renaming-existing-versions">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="renaming-existing-versions"></a><a href="#renaming-existing-versions" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Renaming Existing Versions</h2>
|
||||
<p>To rename an existing version number to something else, first make sure the following script is in your <code>package.json</code> file:</p>
|
||||
<pre><code class="hljs css json">...
|
||||
"scripts": {
|
||||
|
@ -42,7 +42,7 @@
|
|||
<p>Run the script with command line arguments of first, the current version name, then second, the new version name. e.g.,</p>
|
||||
<pre><code class="hljs css bash">npm run rename-version 1.0.0 1.0.1
|
||||
</code></pre>
|
||||
<h2><a class="anchor" name="versioning-and-translations"></a>Versioning and Translations <a class="hash-link" href="#versioning-and-translations">#</a></h2>
|
||||
<h2><a class="anchor" aria-hidden="true" name="versioning-and-translations"></a><a href="#versioning-and-translations" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Versioning and Translations</h2>
|
||||
<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 <a href="translation.md">translations guide</a>.</p>
|
||||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="search.html">← Enabling Search</a><a class="docs-next button" href="commands.html">CLI Commands →</a></div></div></div></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/docusaurus_monochrome.svg" alt="Docusaurus" width="66" height="58"/></a><div><h5>Docs</h5><a href="
|
||||
/docs/installation.html">Getting Started</a></div><div><h5>Community</h5><a href="/en/users.html">User Showcase</a></div><div><h5>More</h5><a href="https://github.com/facebookexperimental/docusaurus">GitHub</a><a class="github-button" href="https://github.com/facebookexperimental/docusaurus" data-icon="octicon-star" data-show-count="true" aria-label="Star this project on GitHub">Star</a></div></section><a href="https://code.facebook.com/projects/" target="_blank" class="fbOpenSource"><img src="/img/oss_logo.png" alt="Facebook Open Source" width="170" height="45"/></a><section class="copyright"><span>Copyright © 2017 Facebook Inc.</span></section></footer></div><script type="text/javascript" src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script><script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue