diff --git a/package.json b/package.json index 835b15f61c7e..59bffe17290d 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "canary:publish": "yarn lerna publish from-package --dist-tag canary --yes --no-verify-access", "changelog": "lerna-changelog", "postinstall": "yarn lock:update && yarn build:packages", - "prettier": "prettier --config .prettierrc --write \"**/*.{js,ts}\"", - "prettier:diff": "prettier --config .prettierrc --list-different \"**/*.{js,ts}\"", + "prettier": "prettier --config .prettierrc --write \"**/*.{js,jsx,ts,tsx}\"", + "prettier:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx}\"", "prettier-docs": "prettier --config .prettierrc --write \"**/*.md\"", "lint": "yarn lint:js && yarn lint:style", "lint:js": "eslint --cache \"**/*.{js,jsx,ts,tsx}\"", diff --git a/packages/docusaurus-plugin-sitemap/package.json b/packages/docusaurus-plugin-sitemap/package.json index 7e2579adefed..489cc788390f 100644 --- a/packages/docusaurus-plugin-sitemap/package.json +++ b/packages/docusaurus-plugin-sitemap/package.json @@ -19,6 +19,7 @@ "dependencies": { "@docusaurus/core": "2.0.0-alpha.70", "@docusaurus/types": "2.0.0-alpha.70", + "@docusaurus/utils": "2.0.0-alpha.70", "fs-extra": "^9.0.1", "joi": "^17.2.1", "sitemap": "^3.2.2" diff --git a/packages/docusaurus-plugin-sitemap/src/createSitemap.ts b/packages/docusaurus-plugin-sitemap/src/createSitemap.ts index 3a29dda1cdaf..63f137febd05 100644 --- a/packages/docusaurus-plugin-sitemap/src/createSitemap.ts +++ b/packages/docusaurus-plugin-sitemap/src/createSitemap.ts @@ -8,6 +8,7 @@ import sitemap, {Sitemap, SitemapItemOptions} from 'sitemap'; import {PluginOptions} from './types'; import {DocusaurusConfig} from '@docusaurus/types'; +import {addTrailingSlash} from '@docusaurus/utils'; export default function createSitemap( siteConfig: DocusaurusConfig, @@ -23,8 +24,8 @@ export default function createSitemap( const urls = routesPaths .filter((route) => !route.endsWith('404.html')) .map( - (routesPath): SitemapItemOptions => ({ - url: `${routesPath}${trailingSlash && !routesPath.endsWith('/') ? '/' : ''}`, + (routePath): SitemapItemOptions => ({ + url: trailingSlash ? addTrailingSlash(routePath) : routePath, changefreq, priority, }),