mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 17:17:28 +02:00
94 lines
No EOL
12 KiB
HTML
94 lines
No EOL
12 KiB
HTML
<html><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"/><title>Navigation and Sidebars · Docusaurus</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta property="og:title" content="Navigation and Sidebars · Docusaurus"/><meta property="og:type" content="website"/><meta property="og:url" content="https://docusaurus.io/index.html"/><meta property="og:description" content="## New Hidden Docs"/><meta name="robots" content="noindex"/><link rel="shortcut icon" href="/img/docusaurus.ico"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css"/><link rel="stylesheet" href="/css/main.css"/><link rel="alternate" type="application/atom+xml" href="https://docusaurus.io/blog/atom.xml" title="Docusaurus Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://docusaurus.io/blog/feed.xml" title="Docusaurus Blog RSS Feed"/><script async="" defer="" src="https://buttons.github.io/buttons.js"></script><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-dark.min.css"/></head><body class="sideNavVisible"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/docusaurus.svg"/><h2 class="headerTitle">Docusaurus</h2></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-internal"><li><a href="/docs/en/installation.html" target="_self">Docs</a></li><li><a href="/en/help.html" target="_self">Help</a></li><li><a href="/blog" target="_self">Blog</a></li><li><a href="https://github.com/facebookexperimental/docusaurus" target="_self">GitHub</a></li><li class="navSearchWrapper reactNavSearchWrapper"><input type="text" id="search_input_react" placeholder="Search"/></li></ul></nav></div></header></div></div><div class="navPusher"><div class="docMainWrapper wrapper"><div class="container docsNavContainer" id="docsNav"><nav class="toc"><div class="toggleNav"><section class="navWrapper wrapper"><div class="navBreadcrumb wrapper"><div class="navToggle" id="navToggler"><i></i></div><h2><i>›</i><span>Guides</span></h2></div><div class="navGroups"><div class="navGroup navGroupActive"><h3>Getting Started</h3><ul><li class="navListItem"><a class="navItem" href="/docs/en/installation.html">Installation</a></li><li class="navListItem"><a class="navItem" href="/docs/en/site-preparation.html">Site Preparation</a></li><li class="navListItem"><a class="navItem" href="/docs/en/site-creation.html">Creating your site</a></li><li class="navListItem"><a class="navItem" href="/docs/en/publishing.html">Publishing your site</a></li></ul></div><div class="navGroup navGroupActive"><h3>Guides</h3><ul><li class="navListItem"><a class="navItem" href="/docs/en/custom-pages.html">Custom Pages</a></li><li class="navListItem navListItemActive"><a class="navItem navItemActive" href="/docs/en/navigation.html">Navigation and Sidebars</a></li><li class="navListItem"><a class="navItem" href="/docs/en/blog.html">Adding a Blog</a></li><li class="navListItem"><a class="navItem" href="/docs/en/translation.html">Translations & Localization</a></li><li class="navListItem"><a class="navItem" href="/docs/en/search.html">Enabling Search</a></li><li class="navListItem"><a class="navItem" href="/docs/en/versioning.html">Versioning</a></li></ul></div><div class="navGroup navGroupActive"><h3>API</h3><ul><li class="navListItem"><a class="navItem" href="/docs/en/commands.html">CLI Commands</a></li><li class="navListItem"><a class="navItem" href="/docs/en/api-pages.html">Pages and Styles</a></li><li class="navListItem"><a class="navItem" href="/docs/en/site-config.html">siteConfig.js</a></li><li class="navListItem"><a class="navItem" href="/docs/en/doc-markdown.html">Markdown Features</a></li></ul></div></div></section></div><script>
|
||
var toggler = document.getElementById('navToggler');
|
||
var nav = document.getElementById('docsNav');
|
||
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>
|
||
<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><span class="hljs-meta">---</span>
|
||
<span class="hljs-attr">id:</span> <span class="hljs-string">intro</span>
|
||
<span class="hljs-attr">title:</span> <span class="hljs-string">Getting</span> <span class="hljs-string">Started</span>
|
||
<span class="hljs-meta">---</span>
|
||
|
||
<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>
|
||
<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>{
|
||
<span class="hljs-string">"docs"</span>: {
|
||
<span class="hljs-string">"Getting Started"</span>: [
|
||
<span class="hljs-string">"getting-started"</span>
|
||
</code></pre>
|
||
<p>Or you can create a new category within the sidebar:</p>
|
||
<pre><code>{
|
||
<span class="hljs-string">"docs"</span>: {
|
||
...
|
||
<span class="hljs-string">"My New Sidebar Category"</span>: [
|
||
<span class="hljs-string">"getting-started"</span>
|
||
],
|
||
...
|
||
</code></pre>
|
||
<h2><a class="anchor" name="new-hidden-sections"></a>New Hidden Sections <a class="hash-link" href="#new-hidden-sections">#</a></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>{
|
||
<span class="hljs-string">"intro"</span>: {
|
||
<span class="hljs-string">"My Sidebar Category"</span>: [
|
||
<span class="hljs-string">"getting-started"</span>
|
||
],
|
||
},
|
||
...
|
||
</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>
|
||
<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>headerLinks: [
|
||
...
|
||
{ doc: <span class="hljs-string">'intro'</span>, <span class="hljs-keyword">label</span><span class="bash">: <span class="hljs-string">'Getting Started'</span> },
|
||
</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>
|
||
<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>headerLinks: [
|
||
...
|
||
{ page: <span class="hljs-string">'help'</span>, <span class="hljs-keyword">label</span><span class="bash">: <span class="hljs-string">'Help'</span> },
|
||
</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>
|
||
<p>Custom links can be added to the nav bar with the following entry in <code>siteConfig.js</code>:</p>
|
||
<pre><code>headerLinks: [
|
||
...
|
||
{ href: <span class="hljs-string">'https://github.com/facebookexperimental/Docusaurus'</span>, <span class="hljs-keyword">label</span><span class="bash">: <span class="hljs-string">'GitHub'</span> },
|
||
</span> ...
|
||
],
|
||
</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>
|
||
<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><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> },
|
||
{ <span class="hljs-string">search:</span> <span class="hljs-literal">true</span> },
|
||
{ <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>
|
||
<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><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> },
|
||
{ <span class="hljs-string">languages:</span> <span class="hljs-literal">true</span> },
|
||
{ <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>
|
||
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="custom-pages.html">← Previous</a><a class="docs-next button" href="blog.html">Next →</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-count-href="/facebookexperimental/docusaurus/stargazers" data-count-api="/repos/facebookexperimental/docusaurus#stargazers_count" data-count-aria-label="# stargazers on GitHub" 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>
|
||
var search = docsearch({
|
||
apiKey: '3eb9507824b8be89e7a199ecaa1a9d2c',
|
||
indexName: 'docusaurus',
|
||
inputSelector: '#search_input_react'
|
||
});
|
||
</script><script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script><script>hljs.initHighlightingOnLoad();</script></body></html> |