mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-29 08:57:03 +02:00
fix(v2): sitemap plugin should handle siteConfig.trailingSlash automatically (#4950)
* create new @docusaurus/utils-common and move applyTrailingSlash there * sitemap plugin should handle siteConfig.trailingSlash automatically * typo
This commit is contained in:
parent
4e5f0febb9
commit
aeb8e9da51
18 changed files with 127 additions and 35 deletions
|
@ -1,3 +1,3 @@
|
|||
# `@docusaurus/utils`
|
||||
|
||||
Node validation utility functions for Docusaurus packages.
|
||||
Node utility functions for Docusaurus packages.
|
||||
|
|
|
@ -313,13 +313,15 @@ export function resolvePathname(to: string, from?: string): string {
|
|||
export function addLeadingSlash(str: string): string {
|
||||
return str.startsWith('/') ? str : `/${str}`;
|
||||
}
|
||||
export function addTrailingSlash(str: string): string {
|
||||
return str.endsWith('/') ? str : `${str}/`;
|
||||
}
|
||||
|
||||
export function addTrailingPathSeparator(str: string): string {
|
||||
return str.endsWith(path.sep) ? str : `${str}${path.sep}`;
|
||||
}
|
||||
|
||||
// TODO deduplicate: also present in @docusaurus/utils-common
|
||||
export function addTrailingSlash(str: string): string {
|
||||
return str.endsWith('/') ? str : `${str}/`;
|
||||
}
|
||||
export function removeTrailingSlash(str: string): string {
|
||||
return removeSuffix(str, '/');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue