Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityMazda CX-5 im Test: Familien-SUV mit guten Fahreigenschaften(21.09.2026 um 15:30 Uhr)
Unix & Linux ServerSecurity: Mehrere Probleme in pcre2 (SUSE)(21.09.2026 um 16:22 Uhr)
Unix & Linux ServerSecurity: Überschreiben von Dateien in abrt (Red Hat)(21.09.2026 um 16:22 Uhr)
Unix & Linux ServerSecurity: Zwei Probleme in libvirt (Red Hat)(21.09.2026 um 16:22 Uhr)
Windows Tipps & SecurityMazda CX-5 im Test: Familien-SUV mit guten Fahreigenschaften(21.09.2026 um 15:30 Uhr)
Unix & Linux ServerSecurity: Mehrere Probleme in pcre2 (SUSE)(21.09.2026 um 16:22 Uhr)
Unix & Linux ServerSecurity: Überschreiben von Dateien in abrt (Red Hat)(21.09.2026 um 16:22 Uhr)
Unix & Linux ServerSecurity: Zwei Probleme in libvirt (Red Hat)(21.09.2026 um 16:22 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Generating a multilingual llms.txt in Astro

llms.txt is a Markdown index for LLMs, placed at the site root. Where sitemap.xml is a machine-readable list of URLs, llms.txt describes — with one-line notes — what the site is and where to start reading. In Astro you can generate it fro…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

llms.txt is a Markdown index for LLMs, placed at the site root. Where sitemap.xml is a machine-readable list of URLs, llms.txt describes — with one-line notes — what the site is and where to start reading.



In Astro you can generate it from Content Collections as an API route, so the post list never has to be hand-maintained. This post is the minimum setup for a bilingual (EN/JA) site: emit /llms.txt, /ja/llms.txt and /llms-full.txt from one renderer.



Up front: how much llms.txt actually helps AI-search traffic isn't a settled or measured thing yet. This is only about the implementation.






The minimal route



Astro's file-based API routes return text when you drop a .txt.ts file under src/pages/. Return a text/plain Response from a GET handler.




// src/pages/llms.txt.ts
import type { APIContext } from "astro";
import { renderLlmsTxt } from "../lib/llmsTxt";

export async function GET(_context: APIContext) {
const body = await renderLlmsTxt({ docLang: "en" });
return new Response(body, {
status: 200,
headers: {
"Content-Type": "text/plain; charset=utf-8",
"Cache-Control": "public, max-age=3600",
},
});
}






The .txt.ts extension builds to the URL /llms.txt. Keep the assembly logic in src/lib/llmsTxt.ts and leave the route thin, so a per-language endpoint can reuse it.






Build it from Content Collections



Get the post list with getCollection and lay it out on the fly. A hand-kept list goes stale — add a post, forget the index, and llms.txt drifts from the content.




// src/lib/llmsTxt.ts (excerpt)
export async function renderLlmsTxt(opts: LlmsTxtOptions): Promise<string> {
const blog = await getCollection("blog", ({ data }) => !data.draft);
blog.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime());
// ...assemble sections and return join("\n")
}






Don't drop the ({ data }) => !data.draft filter. Skip it and a half-written draft lands in llms.txt, advertising a URL you haven't published. Reuse the same exclusion sitemap and RSS use.






Split by language on two axes



This is the part that matters for a multilingual site. Give the renderer two axes:





  • filterLang: which language's posts to include


  • docLang: which language the headings and notes are written in



Separating them lets one renderer emit three endpoints.




// src/pages/llms.txt.ts        → English headings, posts from all languages
renderLlmsTxt({ docLang: "en" });

// src/pages/ja/llms.txt.ts → Japanese headings, Japanese posts only
renderLlmsTxt({ filterLang: "ja", docLang: "ja" });






The English /llms.txt leaves filterLang unset on purpose — it's the whole-site entry point, so it surfaces posts in either language. The Japanese /ja/llms.txt closes to the Japanese surface with filterLang: "ja".






Narrow only the featured list to docLang



One design call. The English version can surface both languages, but the Featured section alone narrows to docLang.




const featuredSource = filteredBlog.filter(
(p) => entryLangLocal(p.id) === opts.docLang,
);






Listing both halves of a translation pair in the featured slots spends two slots on one piece of content and halves the unique signal in a bounded list. So a limited list (featured) narrows by language; a full dump with loose size limits (llms-full.txt) carries both.






Gotchas





  • Put the draft exclusion in the shared renderer: so all three endpoints pass the same filter. Let one route through raw and drafts leak


  • Don't conflate filterLang and docLang: "which posts" and "what language to write in" are different axes. Leaving filterLang unset on the English version is deliberate — don't read it later as a bug and add a filter






Wrapping up



Generate llms.txt from Content Collections as an Astro API route and the manual upkeep goes away. Split on filterLang and docLang and one renderer emits all three files.



The language cross-references in llms-full.txt, how it sits next to robots.txt, and how I word the usage/citation section are on the Aulvem site → Generating llms.txt and llms-full.txt in Astro for a Bilingual Site

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Generating a multilingual llms.txt in Astro

Thematisch verwandte Begriffe: Generating, multilingual, llmstxt, Astro · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94216 | A vulnerability was determined in ST Engineering iDirect Evolution and V…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick