Small fix for the sitemap generator
This commit is contained in:
parent
2730ceeb62
commit
c0f4dc446e
1 changed files with 12 additions and 13 deletions
|
|
@ -45,23 +45,22 @@ export const generateSitemap = async () => {
|
|||
|
||||
const postListSiteMap = postList.map(post => {
|
||||
return `
|
||||
<url>
|
||||
<loc>${`${config.siteURL}/news/${post.slug}`}</loc>
|
||||
<lastmod>${post.updatedAt}</lastmod>
|
||||
<priority>0.5</priority>
|
||||
</url>`
|
||||
<url>
|
||||
<loc>${`${config.siteURL}/news/${post.slug}`}</loc>
|
||||
<lastmod>${post.updatedAt}</lastmod>
|
||||
<priority>0.5</priority>
|
||||
</url>`
|
||||
})
|
||||
.join("")
|
||||
|
||||
const generatedSitemap = `
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset
|
||||
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
|
||||
>${pageListMap}
|
||||
${postListSiteMap}
|
||||
</urlset>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset
|
||||
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
|
||||
>${pageListMap}${postListSiteMap}
|
||||
</urlset>
|
||||
`
|
||||
|
||||
console.log(generatedSitemap)
|
||||
|
|
|
|||
Loading…
Reference in a new issue