app/routes/llms.ts
26 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| loader | 15 to 29 | 2 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
Imports
It imports app/db/index.ts, app/lib/context.ts, app/lib/llms/validate.mjs, app/lib/markdown-twin.ts, app/lib/seo.ts. No module of this repo imports it.
Source
import { getSetting } from "~/db";
import { getEnv } from "~/lib/context";
import { canonicalLink } from "~/lib/markdown-twin";
import { LLMS_CACHE_TAG, LLMS_SETTING_KEY } from "~/lib/llms/validate.mjs";
import llmsTxt from "../../content/llms.txt?raw";
import type { Route } from "./+types/llms";
import { HOURLY_CACHE_CONTROL } from "~/lib/seo";
/**
* The content file itself, inlined by Vite, so the fallback cannot drift from what the sync writes.
* .gitattributes pins it to LF, so the inlined copy and the row are byte-identical on every platform.
*/
const FALLBACK = llmsTxt;
export async function loader({ context }: Route.LoaderArgs) {
const value = await getSetting(getEnv(context), LLMS_SETTING_KEY);
return new Response(value ?? FALLBACK, {
headers: {
"content-type": "text/plain; charset=utf-8",
"x-robots-tag": "noindex",
// The site it describes: a crawler that lands here is pointed at the page people read.
link: canonicalLink("/"),
"cache-control": HOURLY_CACHE_CONTROL,
// A save through Carrel purges this tag, so the edge serves the edit without waiting out the hour.
"cache-tag": LLMS_CACHE_TAG,
},
});
}