1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 02:55:01 +00:00
mon-entreprise/site/scripts/build-sitemap.ts
2022-08-23 12:59:42 +02:00

21 lines
677 B
TypeScript

import { writeFileSync } from 'node:fs'
import { absoluteSitePaths, generateSiteMap } from '../source/sitePaths.js'
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'
const enSiteMap = generateSiteMap(absoluteSitePaths.en).map(
(path) => basePathEn + path
)
const frSiteMap = generateSiteMap(absoluteSitePaths.fr).map(
(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',
})