diff --git a/packages/docusaurus-theme-classic/src/__tests__/utils.test.js b/packages/docusaurus-theme-classic/src/__tests__/utils.test.js index b1c177f7b1..3c78736caf 100644 --- a/packages/docusaurus-theme-classic/src/__tests__/utils.test.js +++ b/packages/docusaurus-theme-classic/src/__tests__/utils.test.js @@ -13,7 +13,7 @@ describe('isSamePath', () => { }); test('should be true for compared path with trailing slash', () => { - expect(isSamePath('/docs', '/docs')).toBeTruthy(); + expect(isSamePath('/docs', '/docs/')).toBeTruthy(); }); test('should be false for compared path with double trailing slash', () => { diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx index 8befa845b3..858abdeb65 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx @@ -60,7 +60,7 @@ export default function DocsVersionDropdownNavbarItem({ // We don't want to render a version dropdown with 0 or 1 item // If we build the site with a single docs version (onlyIncludeVersions: ['1.0.0']) - // We'd rather render a buttonb instead of a dropdown + // We'd rather render a button instead of a dropdown if (items.length <= 1) { return undefined; } diff --git a/packages/docusaurus/src/client/templates/ssr.html.template.js b/packages/docusaurus/src/client/templates/ssr.html.template.js index 5dc8f45547..0915f8ac2a 100644 --- a/packages/docusaurus/src/client/templates/ssr.html.template.js +++ b/packages/docusaurus/src/client/templates/ssr.html.template.js @@ -12,8 +12,8 @@ module.exports = ` - <%if (it.noIndex) { %> - + <% if (it.noIndex) { %> + <% } %> <%~ it.headTags %> <% it.metaAttributes.forEach((metaAttribute) => { %> diff --git a/website-1.x/data/users.js b/website-1.x/data/users.js index cd8df05433..53f31f2a9f 100644 --- a/website-1.x/data/users.js +++ b/website-1.x/data/users.js @@ -896,7 +896,7 @@ const users = [ users.forEach((user) => { if (!user.image || !user.image.startsWith('/img/users/')) { throw new Error( - `Bad user site image = ${user.image}. The image should be hosted on Docusaurus site, in /static/img/users/ folder, and not use remote http or https urls`, + `Bad user site image = ${user.image}. The image should be hosted on Docusaurus site, in /static/img/users/ folder, and not use remote HTTP or HTTPS URLs`, ); } }); diff --git a/website/docs/api/docusaurus.config.js.md b/website/docs/api/docusaurus.config.js.md index 9590c56bcf..ac7ff9d5f8 100644 --- a/website/docs/api/docusaurus.config.js.md +++ b/website/docs/api/docusaurus.config.js.md @@ -84,13 +84,13 @@ module.exports = { - Type: `boolean` -This option adds `` in pages, to tell search engines to avoid indexing your site (more information [here](https://moz.com/learn/seo/robots-meta-directives)). +This option adds `` in pages, to tell search engines to avoid indexing your site (more information [here](https://moz.com/learn/seo/robots-meta-directives)). Example: ```js title="docusaurus.config.js" module.exports = { - noIndex: true, // Defaults to false + noIndex: true, // Defaults to `false` }; ``` diff --git a/website/docs/lifecycle-apis.md b/website/docs/lifecycle-apis.md index 0cbf6247d0..e597b792d4 100644 --- a/website/docs/lifecycle-apis.md +++ b/website/docs/lifecycle-apis.md @@ -299,10 +299,11 @@ You may use them to return your webpack configures conditionally. For example, this plugin below modify the webpack config to transpile `.foo` file. -```js {4-11} title="docusaurus-plugin/src/index.js" +```js title="docusaurus-plugin/src/index.js" module.exports = function (context, options) { return { name: 'custom-docusaurus-plugin', + // highlight-start configureWebpack(config, isServer, utils) { const {getCacheLoader} = utils; return { @@ -316,6 +317,7 @@ module.exports = function (context, options) { }, }; }, + // highlight-end }; }; ``` @@ -326,14 +328,16 @@ We merge the Webpack configuration parts of plugins into the global Webpack conf It is possible to specify the merge strategy. For example, if you want a webpack rule to be prepended instead of appended: -```js {4-11} title="docusaurus-plugin/src/index.js" +```js title="docusaurus-plugin/src/index.js" module.exports = function (context, options) { return { name: 'custom-docusaurus-plugin', configureWebpack(config, isServer, utils) { return { + // highlight-start mergeStrategy: {'module.rules': 'prepend'}, module: {rules: [myRuleToPrepend]}, + // highlight-end }; }, }; @@ -433,10 +437,11 @@ interface HtmlTagObject { Example: -```js {4-28} title="docusaurus-plugin/src/index.js" +```js title="docusaurus-plugin/src/index.js" module.exports = function (context, options) { return { name: 'docusaurus-plugin', + // highlight-start injectHtmlTags() { return { headTags: [ @@ -460,6 +465,7 @@ module.exports = function (context, options) { postBodyTags: [`
This is post body
`], }; }, + // highlight-end }; }; ``` diff --git a/website/docs/theme-classic.md b/website/docs/theme-classic.md index 32285f3ffb..64e93462b4 100644 --- a/website/docs/theme-classic.md +++ b/website/docs/theme-classic.md @@ -190,11 +190,12 @@ You can add items to the navbar via `themeConfig.navbar.items`. By default, Navbar items are regular links (internal or external). -```js {5-15} title="docusaurus.config.js" +```js title="docusaurus.config.js" module.exports = { // ... themeConfig: { navbar: { + // highlight-start items: [ { // Client-side routing, used for navigating within the website. @@ -220,6 +221,7 @@ module.exports = { }, // ... other items ], + // highlight-end }, // ... }, @@ -266,11 +268,12 @@ module.exports = { If you want to link to a specific doc, this special navbar item type will render the link to the doc of the provided `docId`. It will get the class `navbar__link--active` as long as you browse a doc of the same sidebar. -```js {5-10} title="docusaurus.config.js" +```js title="docusaurus.config.js" module.exports = { themeConfig: { navbar: { items: [ + // highlight-start { type: 'doc', position: 'left', @@ -278,6 +281,7 @@ module.exports = { label: 'Docs', activeSidebarClassName: 'navbar__link--active', }, + // highlight-end ], }, }, @@ -314,17 +318,19 @@ module.exports = { If you use docs with versioning, this special navbar item type will link to the active/browsed version of your doc (depends on the current url), and fallback to the latest version. -```js {5-10} title="docusaurus.config.js" +```js title="docusaurus.config.js" module.exports = { themeConfig: { navbar: { items: [ + // highlight-start { type: 'docsVersion', position: 'left', // to: "/path // by default, link to active/latest version // label: "label" // by default, show active/latest version label }, + // highlight-end ], }, }, diff --git a/website/src/data/users.js b/website/src/data/users.js index cef10305ec..7073ff1555 100644 --- a/website/src/data/users.js +++ b/website/src/data/users.js @@ -303,7 +303,7 @@ users.forEach((user) => { (user.preview.startsWith('http') || user.preview.startsWith('//'))) ) { throw new Error( - `Bad user site image preview = ${user.preview}. The image should be hosted on Docusaurus site, and not use remote http or https urls`, + `Bad user site image preview = ${user.preview}. The image should be hosted on Docusaurus site, and not use remote HTTP or HTTPS URLs`, ); } }); diff --git a/website/static/manifest.json b/website/static/manifest.json index 6eb335eeaf..e63e70590c 100644 --- a/website/static/manifest.json +++ b/website/static/manifest.json @@ -4,7 +4,7 @@ "theme_color": "#2196f3", "background_color": "#424242", "display": "standalone", - "scope": "", + "scope": "./", "start_url": "./index.html", "icons": [ {