We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 77850b9 commit c92b0ffCopy full SHA for c92b0ff
1 file changed
app/llms.txt/route.ts
@@ -0,0 +1,29 @@
1
+import { getAllPosts } from "@/lib/blog";
2
+import { absoluteUrl, siteConfig } from "@/lib/site";
3
+
4
+export const dynamic = "force-static";
5
6
+export async function GET() {
7
+ const posts = await getAllPosts();
8
9
+ const lines = [
10
+ `# ${siteConfig.name}`,
11
+ "",
12
+ `> ${siteConfig.description}`,
13
14
+ "## Blog",
15
16
+ ...posts.map(
17
+ (post) =>
18
+ `- [${post.title}](${absoluteUrl(`/blog/${post.slug}/index.md`)}): ${post.description}`,
19
+ ),
20
21
+ ];
22
23
+ return new Response(lines.join("\n"), {
24
+ headers: {
25
+ "Content-Type": "text/plain; charset=utf-8",
26
+ "Cache-Control": "public, s-maxage=3600, stale-while-revalidate=86400",
27
+ },
28
+ });
29
+}
0 commit comments