fix(seo): include circuitExamples in sitemap generator

generate-sitemap.mjs was only scanning examples.ts for example IDs using a
textual regex. With the 40 new circuit examples living in a separate file
(examples-circuits.ts), they were missing from the generated sitemap.xml
and therefore invisible to search engines / SSR prerender URL list.

Now the generator reads both source files and merges their example IDs.

Also includes auto-applied formatting changes to generate-component-metadata.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Montero Crespo 2026-04-16 01:06:26 -03:00
parent 3b240a9168
commit b422f2b4c1
1 changed files with 8 additions and 2 deletions

View File

@ -47,9 +47,15 @@ const routes = new Function('DOMAIN', `return [${arrayStr}]`)(DOMAIN);
const indexable = routes.filter((r) => !r.noindex);
// Parse example project IDs and add /examples/:id URLs
// Parse example project IDs and add /examples/:id URLs.
// Reads both examples.ts (legacy) and examples-circuits.ts (analog/digital/
// electromech examples added in circuitExamples).
const examplesSource = readFileSync(resolve(__dirname, '../src/data/examples.ts'), 'utf-8');
const exampleIds = parseExampleIds(examplesSource);
const circuitSource = readFileSync(resolve(__dirname, '../src/data/examples-circuits.ts'), 'utf-8');
const exampleIds = [
...parseExampleIds(examplesSource),
...parseExampleIds(circuitSource),
];
const exampleUrls = exampleIds.map((id) => ({
loc: `${DOMAIN}/examples/${id}`,