mon-entreprise/site/build/build-sitemap.ts

23 lines
678 B
TypeScript
Raw Normal View History

2022-06-13 11:07:46 +00:00
import { writeFileSync } from 'node:fs'
2022-11-03 16:32:04 +00:00
import { absoluteSitePaths, generateSiteMap } from '../source/sitePaths.js'
2022-06-13 11:07:46 +00:00
const basePathEn =
process.env.VITE_EN_BASE_URL ?? 'http://localhost:3000/infrance'
const basePathFr =
process.env.VITE_FR_BASE_URL ?? 'http://localhost:3000/mon-entreprise'
2022-07-28 18:04:44 +00:00
const enSiteMap = generateSiteMap(absoluteSitePaths.en).map(
2022-06-13 11:07:46 +00:00
(path) => basePathEn + path
)
2022-07-28 18:04:44 +00:00
const frSiteMap = generateSiteMap(absoluteSitePaths.fr).map(
2022-06-13 11:07:46 +00:00
(path) => basePathFr + path
)
writeFileSync('source/public/sitemap.en.txt', enSiteMap.join('\n') + '\n', {
encoding: 'utf8',
})
writeFileSync('source/public/sitemap.fr.txt', frSiteMap.join('\n') + '\n', {
encoding: 'utf8',
})