summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/generate-sitemap.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts/generate-sitemap.ts b/scripts/generate-sitemap.ts
index e521365..3270fea 100644
--- a/scripts/generate-sitemap.ts
+++ b/scripts/generate-sitemap.ts
@@ -12,25 +12,25 @@ const postsDir = path.join(projectRoot, 'src', 'posts');
const sitemapPath = path.join(projectRoot, 'static', 'sitemap.txt');
async function getPostRoutes(): Promise<string[]> {
- const files = await fs.readdir(postsDir);
+ const files = await fs.readdir(postsDir);
- return files
- .filter((file) => file.endsWith('.svx'))
- .map((file) => `/posts/${file.replace(/\.svx$/, '')}`)
- .sort();
+ return files
+ .filter((file) => file.endsWith('.svx'))
+ .map((file) => `/posts/${file.replace(/\.svx$/, '')}`)
+ .sort();
}
async function main(): Promise<void> {
- const postRoutes = await getPostRoutes();
- const urls = [...STATIC_ROUTES, ...postRoutes].map((route) => `${SITE_URL}${route}`);
- const body = `${urls.join('\n')}\n`;
+ const postRoutes = await getPostRoutes();
+ const urls = [...STATIC_ROUTES, ...postRoutes].map((route) => `${SITE_URL}${route}`);
+ const body = `${urls.join('\n')}\n`;
- await fs.writeFile(sitemapPath, body, 'utf8');
- console.log(`Generated sitemap: ${path.relative(projectRoot, sitemapPath)} (${urls.length} URLs)`);
+ await fs.writeFile(sitemapPath, body, 'utf8');
+ console.log(`Generated sitemap: ${path.relative(projectRoot, sitemapPath)} (${urls.length} URLs)`);
}
main().catch((error: unknown) => {
- console.error('Failed to generate sitemap.txt');
- console.error(error);
- process.exit(1);
+ console.error('Failed to generate sitemap.txt');
+ console.error(error);
+ process.exit(1);
});