mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-30 09:27:04 +02:00
refactor(v2): determine all available routes/url (#1264)
* refactor(v2): determine all available routes/url * nits * test(v2): routes snapshot * sort for consistent snapshot test due to async ordering
This commit is contained in:
parent
c73da00252
commit
2ad7413dd7
5 changed files with 114 additions and 41 deletions
|
@ -10,17 +10,8 @@ const loadConfig = require('../load/config');
|
|||
|
||||
module.exports = async function createSitemap({
|
||||
siteConfig = {},
|
||||
docsMetadatas = {},
|
||||
pagesMetadatas = [],
|
||||
// TODO: Generalize for blog plugin.
|
||||
blogMetadatas = [],
|
||||
routesPaths = [],
|
||||
}) {
|
||||
const allMetadatas = [
|
||||
...blogMetadatas,
|
||||
...Object.values(docsMetadatas),
|
||||
...pagesMetadatas,
|
||||
];
|
||||
|
||||
const {url: siteUrl} = siteConfig;
|
||||
|
||||
if (!siteUrl) {
|
||||
|
@ -29,8 +20,8 @@ module.exports = async function createSitemap({
|
|||
);
|
||||
}
|
||||
|
||||
const urls = allMetadatas.map(metadata => ({
|
||||
url: metadata.permalink,
|
||||
const urls = routesPaths.map(routesPath => ({
|
||||
url: routesPath,
|
||||
changefreq: 'weekly',
|
||||
priority: 0.5,
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue