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: [`