Skip to content

Commit a6e55d1

Browse files
committed
Streamline other format lists
1 parent e1c58a2 commit a6e55d1

File tree

4 files changed

+27
-37
lines changed

4 files changed

+27
-37
lines changed

src/pages/llms-full.txt.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { conceptPagePath, startPagePath } from "../lib/utils";
22
import { site } from "../site";
3+
import { FORMATS } from "./llms.txt";
34
import type { APIRoute } from "astro";
45
import { getCollection } from "astro:content";
56
import Handlebars from "handlebars";
@@ -38,18 +39,7 @@ export const GET: APIRoute = async () => {
3839
href: `${root}/${conceptPagePath(slug)}`,
3940
content: body,
4041
})),
41-
otherFormats: [
42-
{
43-
root,
44-
file: "llms.txt",
45-
description: "the main version",
46-
},
47-
{
48-
root,
49-
file: "llms-full.txt",
50-
description: "complete content in one file",
51-
},
52-
],
42+
otherFormats: [FORMATS.small, FORMATS.standard],
5343
});
5444

5545
return new Response(content, {

src/pages/llms-small.txt.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { site } from "../site";
2+
import { FORMATS } from "./llms.txt";
23
import type { APIRoute } from "astro";
34
import { getCollection } from "astro:content";
45
import Handlebars from "handlebars";
@@ -28,18 +29,7 @@ export const GET: APIRoute = async () => {
2829
conceptPages: conceptPages.map(({ data: { title } }) => ({
2930
title,
3031
})),
31-
otherFormats: [
32-
{
33-
root,
34-
file: "llms.txt",
35-
description: "the main version",
36-
},
37-
{
38-
root,
39-
file: "llms-full.txt",
40-
description: "complete content in one file",
41-
},
42-
],
32+
otherFormats: [FORMATS.standard, FORMATS.full],
4333
});
4434

4535
return new Response(content, {

src/pages/llms.txt.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,27 @@ import path from "node:path";
88

99
const { url: root, title, description: tagline, llms } = site;
1010

11+
export const FORMATS: Record<
12+
string,
13+
{ root: string; file: string; description: string }
14+
> = {
15+
standard: {
16+
root,
17+
file: "llms.txt",
18+
description: "the main version",
19+
},
20+
small: {
21+
root,
22+
file: "llms-small.txt",
23+
description: "compact structure-only version",
24+
},
25+
full: {
26+
root,
27+
file: "llms-full.txt",
28+
description: "complete content in one file",
29+
},
30+
};
31+
1132
const templateFile = fs.readFileSync(
1233
path.join(process.cwd(), "src/templates/llms.txt.hbs"),
1334
"utf-8",
@@ -32,18 +53,7 @@ export const GET: APIRoute = async () => {
3253
title,
3354
href: `${root}/${conceptPagePath(slug)}`,
3455
})),
35-
otherFormats: [
36-
{
37-
root,
38-
file: "llms-small.txt",
39-
description: "compact structure-only version",
40-
},
41-
{
42-
root,
43-
file: "llms-full.txt",
44-
description: "complete content in one file",
45-
},
46-
],
56+
otherFormats: [FORMATS.small, FORMATS.full],
4757
});
4858

4959
return new Response(content, {

src/site.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const site: Site = {
5757
description: "Your guide to learning Nix and flakes",
5858
llms: {
5959
description:
60-
"Zero to Nix is an opinionated learning resource for Nix created by [Determinate Systems](https://determinate.systems/llms.txt). It takes you on a [learning journey](#start-pages) from installing Nix to exploring Nix development environments to building Nix packages and more. It also offers a series of [concept pages](#concept-pages) covering some of the trickier corners of Nix.",
60+
"Zero to Nix is a flake-centric resource for learning Nix created by [Determinate Systems](https://determinate.systems/llms.txt). It takes you on a [learning journey](#start-pages) from installing Nix to exploring Nix development environments to building Nix packages and more. It also offers a series of [concept pages](#concept-pages) covering some of the trickier corners of Nix.",
6161
},
6262
githubUrl: "https://github.com/DeterminateSystems/zero-to-nix",
6363
languages: ["C++", "Go", "Haskell", "JavaScript", "Python", "Rust", "Scala"],

0 commit comments

Comments
 (0)