mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +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
|
@ -11,6 +11,7 @@ const glob = require('glob');
|
|||
const CWD = process.cwd();
|
||||
|
||||
const sitemap = require('sitemap');
|
||||
const utils = require('../core/utils');
|
||||
|
||||
const siteConfig = require(CWD + '/siteConfig.js');
|
||||
|
||||
|
@ -67,9 +68,7 @@ module.exports = function(callback) {
|
|||
|
||||
MetadataBlog.map(blog => {
|
||||
urls.push({
|
||||
url:
|
||||
'/blog/' +
|
||||
(siteConfig.cleanUrl ? blog.path.replace(/\.html$/, '') : blog.path),
|
||||
url: '/blog/' + utils.getPath(blog.path, siteConfig.cleanUrl),
|
||||
changefreq: 'weekly',
|
||||
priority: 0.3,
|
||||
});
|
||||
|
@ -79,14 +78,13 @@ module.exports = function(callback) {
|
|||
.filter(key => Metadata[key].language === 'en')
|
||||
.map(key => {
|
||||
let doc = Metadata[key];
|
||||
let docUrl = utils.getPath(doc.permalink, siteConfig.cleanUrl);
|
||||
let links = enabledLanguages.map(lang => {
|
||||
let langUrl = doc.permalink.replace('docs/en/', `docs/${lang.tag}/`);
|
||||
let langUrl = docUrl.replace('docs/en/', `docs/${lang.tag}/`);
|
||||
return {lang: lang.tag, url: langUrl};
|
||||
});
|
||||
urls.push({
|
||||
url: siteConfig.cleanUrl
|
||||
? doc.permalink.replace(/\.html$/, '')
|
||||
: doc.permalink,
|
||||
url: docUrl,
|
||||
changefreq: 'hourly',
|
||||
priority: 1.0,
|
||||
links,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue