docs(v2): nav links activeBasePath (#2303)

* docs(v2): Nav links activeBasePath

* rename activeBaseRoute to activeBasePath

* fixes
This commit is contained in:
Yangshun Tay 2020-02-21 09:44:14 +08:00 committed by GitHub
parent c46bf90f60
commit 787b073bb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 25 deletions

View file

@ -163,6 +163,7 @@ module.exports = {
links: [
{
to: 'docs/docusaurus.config.js',
activeBasePath: 'docs',
label: 'docusaurus.config.js',
position: 'left',
},

View file

@ -11,7 +11,7 @@ title: '@docusaurus/theme-classic'
To remove the ability to switch on dark mode, there is an option `themeConfig.disableDarkMode`, which is implicitly set to `false`.
```js
```js {5}
// docusaurus.config.js
module.exports = {
...
@ -26,15 +26,13 @@ module.exports = {
You can configure a default image that will be used for your meta tag, in particular `og:image` and `twitter:image`.
```js
```js {5-7}
// docusaurus.config.js
module.exports = {
...
themeConfig: {
/**
* Relative to your site's "static" directory.
* Cannot be SVGs. Can be external URLs too.
*/
// Relative to your site's "static" directory.
// Cannot be SVGs. Can be external URLs too.
image: 'img/docusaurus.png',
...
},
@ -47,7 +45,7 @@ module.exports = {
You can add a logo and title to the navbar via `themeConfig.navbar`. Logo can be placed in [static folder](static-assets.md). Logo URL is set to base URL of your site by default. Although you can specify your own URL for the logo, if it is an external link, it will open in a new tab. You can also set a different logo for dark mode.
```js
```js {6-12}
// docusaurus.config.js
module.exports = {
...
@ -70,7 +68,7 @@ module.exports = {
You can add links to the navbar via `themeConfig.navbar.links`:
```js
```js {6-16}
// docusaurus/config.js
module.exports = {
...
@ -81,6 +79,9 @@ module.exports = {
to: 'docs/docusaurus.config.js',
label: 'docusaurus.config.js',
position: 'left',
// To apply the active class styling on all
// routes starting with this path.
activeBasePath: 'docs',
},
// ... other links
],
@ -90,13 +91,13 @@ module.exports = {
}
```
Outbound links automatically get `target="_blank" rel="noopener noreferrer"`.
Outbound links automatically get `target="_blank" rel="noopener noreferrer"` attributes.
### Auto-hide sticky navbar
You can enable this cool UI feature that automatically hides the navbar when a user starts scrolling down the page, and show it again when the user scrolls up.
```js
```js {6}
// docusaurus/config.js
module.exports = {
...
@ -137,7 +138,7 @@ module.exports = {
You can set a default language for code blocks if no language is added after the opening triple backticks (i.e. ```). Note that a valid [language name](https://prismjs.com/#supported-languages) must be passed, e.g.:
```js
```js {6}
// docusaurus/config.js
module.exports = {
...