From 63f845a9d4cd62513555e9b6b77ae45535e70260 Mon Sep 17 00:00:00 2001 From: Petar Cirkovic Date: Tue, 10 Nov 2026 11:14:56 +0100 Subject: [PATCH 1/2] CORE-4519: generate a sitemap for the utilities pages jam.dev/sitemap.xml stopped listing the utilities when the marketing site moved to Framer, and this repo never published its own list. The build now writes public/utilities/sitemap.xml with one entry per page in pages/utilities, so it is served at jam.dev/utilities/sitemap.xml and a new tool is listed without anyone editing a file. --- .gitignore | 3 +++ package.json | 3 ++- scripts/generate-sitemap.mjs | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 scripts/generate-sitemap.mjs diff --git a/.gitignore b/.gitignore index 64f20e4b..b3f4ba9a 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,6 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +# generated by scripts/generate-sitemap.mjs +/public/utilities/sitemap.xml diff --git a/package.json b/package.json index cf09058f..524681c5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "private": true, "scripts": { "dev": "next dev --webpack", - "build": "next build --webpack", + "sitemap": "node scripts/generate-sitemap.mjs", + "build": "npm run sitemap && next build --webpack", "pages:build": "next-on-pages", "start": "next start", "lint": "eslint .", diff --git a/scripts/generate-sitemap.mjs b/scripts/generate-sitemap.mjs new file mode 100644 index 00000000..ad9353a2 --- /dev/null +++ b/scripts/generate-sitemap.mjs @@ -0,0 +1,34 @@ +// Writes public/utilities/sitemap.xml with one entry per page in pages/utilities. +// The site is served at https://jam.dev/utilities, so that is where the file lands. +import { mkdirSync, readdirSync, writeFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const SITE_URL = "https://jam.dev"; + +const root = path.join(path.dirname(fileURLToPath(import.meta.url)), ".."); +const pagesDir = path.join(root, "pages", "utilities"); +const outputFile = path.join(root, "public", "utilities", "sitemap.xml"); + +const urls = readdirSync(pagesDir) + .filter((file) => file.endsWith(".tsx")) + .map((file) => file.replace(/\.tsx$/, "")) + .sort() + .map((page) => { + if (page === "index") { + return `${SITE_URL}/utilities`; + } + return `${SITE_URL}/utilities/${page}`; + }); + +const sitemap = [ + '', + '', + ...urls.map((url) => ` ${url}`), + "", + "", +].join("\n"); + +mkdirSync(path.dirname(outputFile), { recursive: true }); +writeFileSync(outputFile, sitemap); +console.log(`Wrote ${urls.length} URLs to ${path.relative(root, outputFile)}`); From fb45e1a3a06767730110cae565413cf01952e47f Mon Sep 17 00:00:00 2001 From: Petar Cirkovic Date: Tue, 10 Nov 2026 11:51:39 +0100 Subject: [PATCH 2/2] CORE-4519: drop the log line ESLint rejects in the sitemap script The lint config has no Node globals for scripts, so console is undefined there. The build output does not need the line. --- scripts/generate-sitemap.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/generate-sitemap.mjs b/scripts/generate-sitemap.mjs index ad9353a2..93e23503 100644 --- a/scripts/generate-sitemap.mjs +++ b/scripts/generate-sitemap.mjs @@ -31,4 +31,3 @@ const sitemap = [ mkdirSync(path.dirname(outputFile), { recursive: true }); writeFileSync(outputFile, sitemap); -console.log(`Wrote ${urls.length} URLs to ${path.relative(root, outputFile)}`);