1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 22:45:01 +00:00
mon-entreprise/site/scripts/build-sitemap.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
678 B
TypeScript
Raw Normal View History

2022-06-13 13:07:46 +02:00
import { writeFileSync } from 'node:fs'
2022-11-03 17:32:04 +01:00
2022-07-28 20:04:44 +02:00
import { absoluteSitePaths, generateSiteMap } from '../source/sitePaths.js'
2022-06-13 13:07:46 +02: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 20:04:44 +02:00
const enSiteMap = generateSiteMap(absoluteSitePaths.en).map(
2022-06-13 13:07:46 +02:00
(path) => basePathEn + path
)
2022-07-28 20:04:44 +02:00
const frSiteMap = generateSiteMap(absoluteSitePaths.fr).map(
2022-06-13 13:07:46 +02: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',
})