Updated sitemap generator to remove file extensions from static pages and output to sitemap.xml
This commit is contained in:
parent
c0f4dc446e
commit
f13acaf3dd
1 changed files with 3 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ import { getAllPosts } from "../external/cms"
|
|||
import fs from "fs"
|
||||
import prettier from "prettier"
|
||||
import config from './config'
|
||||
import path from "path"
|
||||
|
||||
|
||||
export const generateSitemap = async () => {
|
||||
|
|
@ -22,7 +23,7 @@ export const generateSitemap = async () => {
|
|||
})
|
||||
.map((staticPagePath) => {
|
||||
console.log(staticPagePath)
|
||||
return `${config.siteURL}/${staticPagePath.name}`;
|
||||
return `${config.siteURL}/${path.parse(staticPagePath.name).name}`;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -66,5 +67,5 @@ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitem
|
|||
console.log(generatedSitemap)
|
||||
const formattedSitemap = [formatted(generatedSitemap)];
|
||||
|
||||
fs.writeFileSync("public/sitemap-posts.xml", generatedSitemap, "utf8")
|
||||
fs.writeFileSync("public/sitemap.xml", generatedSitemap, "utf8")
|
||||
}
|
||||
Loading…
Reference in a new issue