diff --git a/app.config.ts b/app.config.ts index 56b652b..01b146e 100644 --- a/app.config.ts +++ b/app.config.ts @@ -76,8 +76,9 @@ export default defineConfig({ }, server: { preset: 'bun', - // prerender: { - // crawlLinks: true, - // }, + prerender: { + crawlLinks: false, + routes: ['/sitemap.xml'] + }, }, }); diff --git a/bun.lockb b/bun.lockb index 69c8aa6..9b87d97 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 0aecb9a..6f0ea11 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "@solidjs/start": "^1.0.10", "dexie": "^4.0.10", "iterator-helpers-polyfill": "^3.0.1", + "sitemap": "^8.0.0", "solid-icons": "^1.1.0", "solid-js": "^1.9.3", "ts-pattern": "^5.5.0", diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..a23c4dc --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Disallow: +Disallow: /cgi-bin/ +Sitemap: https://ca-euw-prd-calque-app.purplecoast-f5b7f657.westeurope.azurecontainerapps.io/sitemap.xml diff --git a/src/app.css b/src/app.css index 1354fbc..d8311b9 100644 --- a/src/app.css +++ b/src/app.css @@ -5,14 +5,16 @@ --primary-100: oklch(from var(--primary-500) .95 c h); --primary-300: oklch(from var(--primary-500) .9 c h); --primary-500: light-dark(oklch(.7503 0.117 var(--hue)), oklch(.8549 0.1149 var(--hue))); - --primary-700: oklch(from var(--primary-500) .7 c h); - --primary-900: oklch(from var(--primary-500) .6 c h); + --primary-600: oklch(from var(--primary-500) .7 c h); + --primary-700: oklch(from var(--primary-500) .6 c h); + --primary-900: oklch(from var(--primary-500) .35 calc(c + .15) h); --secondary-100: oklch(from var(--primary-500) .95 c calc(h + var(--accent-ofset))); --secondary-300: oklch(from var(--primary-500) .9 c calc(h + var(--accent-ofset))); --secondary-500: oklch(from var(--primary-500) .85 c calc(h + var(--accent-ofset))); - --secondary-700: oklch(from var(--primary-500) .7 c calc(h + var(--accent-ofset))); - --secondary-900: oklch(from var(--primary-500) .6 c calc(h + var(--accent-ofset))); + --secondary-600: oklch(from var(--primary-500) .7 c calc(h + var(--accent-ofset))); + --secondary-700: oklch(from var(--primary-500) .6 c calc(h + var(--accent-ofset))); + --secondary-900: oklch(from var(--primary-500) .35 calc(c + .15) calc(h + var(--accent-ofset))); --surface-300: light-dark(oklch(from var(--primary-500) .9 .02 h), oklch(from var(--primary-500) .2 .02 h)); --surface-400: oklch(from var(--surface-300) calc(l + .025) c h); @@ -115,7 +117,11 @@ body { } a { - color: var(--primary-500); + color: var(--primary-900); + + &:visited { + color: var(--secondary-900); + } } h1 { diff --git a/src/routes/(editor).tsx b/src/routes/(editor).tsx index 97fb291..faa92bf 100644 --- a/src/routes/(editor).tsx +++ b/src/routes/(editor).tsx @@ -51,6 +51,7 @@ export default function Editor(props: ParentProps) { Calque + @@ -71,7 +72,7 @@ export default function Editor(props: ParentProps) { - Calque logo + Calque logo diff --git a/src/routes/(editor)/edit.tsx b/src/routes/(editor)/edit.tsx index 9d50b1e..4e61ffa 100644 --- a/src/routes/(editor)/edit.tsx +++ b/src/routes/(editor)/edit.tsx @@ -347,8 +347,6 @@ const Editor: Component<{ root: FileSystemDirectoryHandle }> = (props) => { - - hint: use . to denote nested keys,
i.e. this.is.some.key would be a key that is four levels deep}> diff --git a/src/routes/sitemap.xml.ts b/src/routes/sitemap.xml.ts new file mode 100644 index 0000000..4cdfeea --- /dev/null +++ b/src/routes/sitemap.xml.ts @@ -0,0 +1,36 @@ +import { SitemapStream, streamToPromise } from 'sitemap' +import { App } from 'vinxi'; + +const BASE_URL = 'https://ca-euw-prd-calque-app.purplecoast-f5b7f657.westeurope.azurecontainerapps.io'; + +export async function GET() { + + const sitemap = new SitemapStream({ hostname: BASE_URL }); + + sitemap.write({ url: BASE_URL, changefreq: 'monthly', }); + + for (const route of await getRoutes()) { + sitemap.write({ url: route, changefreq: 'monthly', }); + } + + sitemap.end(); + + return new Response( + (await streamToPromise(sitemap)).toString(), + { status: 200, headers: { 'Content-Type': 'text/xml' } } + ); +} + +const getRoutes = async () => { + const router = ((globalThis as any).app as App).getRouter('client').internals.routes; + + if (router === undefined) { + return []; + } + + const routes = await router.getRoutes() as { page: boolean, $$route?: object, path: string }[]; + + return routes + .filter(r => r.page === true && r.$$route === undefined && !r.path.match(/^.+\*\d+$/)) + .map(r => r.path.replace(/\/\(\w+\)/g, '')); +}; \ No newline at end of file