mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
Configure sitemap depending on whether clean URLs enabled (#765)
* Configure sitemap depending on whether clean URLs enabled * Run Prettier
This commit is contained in:
parent
a2b076bdca
commit
c2ff413650
1 changed files with 10 additions and 5 deletions
|
@ -59,7 +59,9 @@ module.exports = function(callback) {
|
|||
// create a url mapping to all the enabled languages files
|
||||
files.map(file => {
|
||||
let url = file.split('/pages/en')[1];
|
||||
url = url.replace(/\.js$/, '.html');
|
||||
url = siteConfig.cleanUrl
|
||||
? url.replace(/\.js$/, '')
|
||||
: url.replace(/\.js$/, '.html');
|
||||
let links = enabledLanguages.map(lang => {
|
||||
let langUrl = lang.tag + url;
|
||||
return {lang: lang.tag, url: langUrl};
|
||||
|
@ -67,11 +69,12 @@ module.exports = function(callback) {
|
|||
urls.push({url, changefreq: 'weekly', priority: 0.5, links});
|
||||
});
|
||||
|
||||
let htmlFiles = glob.sync(CWD + '/pages/**/*.html');
|
||||
|
||||
MetadataBlog.map(blog => {
|
||||
urls.push({
|
||||
url: '/blog/' + blog.path,
|
||||
url:
|
||||
'/blog/' + siteConfig.cleanUrl
|
||||
? blog.path.replace(/\.html$/, '')
|
||||
: blog.path,
|
||||
changefreq: 'weekly',
|
||||
priority: 0.3,
|
||||
});
|
||||
|
@ -86,7 +89,9 @@ module.exports = function(callback) {
|
|||
return {lang: lang.tag, url: langUrl};
|
||||
});
|
||||
urls.push({
|
||||
url: doc.permalink,
|
||||
url: siteConfig.cleanUrl
|
||||
? doc.permalink.replace(/\.html$/, '')
|
||||
: doc.permalink,
|
||||
changefreq: 'hourly',
|
||||
priority: 1.0,
|
||||
links,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue