mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-28 16:37:07 +02:00
Fix wrong sitemap for alternate URL (#828)
This commit is contained in:
parent
9c070f020d
commit
3566483aa5
5 changed files with 45 additions and 13 deletions
|
@ -20,12 +20,16 @@ function extractBlogPostSummary(content) {
|
|||
return content.substring(0, BLOG_POST_SUMMARY_LENGTH);
|
||||
}
|
||||
|
||||
function removeExtension(path) {
|
||||
return path.replace(/\.[^/.]+$/, '');
|
||||
}
|
||||
|
||||
function getPath(path, cleanUrl = false) {
|
||||
if (cleanUrl) {
|
||||
if (path.endsWith('/index.html')) {
|
||||
return path.replace(/\/index.html$/, '');
|
||||
} else {
|
||||
return path.replace(/\.html$/, '');
|
||||
return removeExtension(path);
|
||||
}
|
||||
}
|
||||
return path;
|
||||
|
@ -36,4 +40,5 @@ module.exports = {
|
|||
extractBlogPostBeforeTruncate,
|
||||
extractBlogPostSummary,
|
||||
getPath,
|
||||
removeExtension,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue