File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
apps/svelte.dev/src/routes/llms.json Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ import { docs } from '$lib/server/content' ;
2+ import { json } from '@sveltejs/kit' ;
3+
4+ export const prerender = true ;
5+
6+ export async function GET ( ) {
7+ return json ( await getLlmDocuments ( ) ) ;
8+ }
9+
10+ async function getLlmDocuments ( ) {
11+ const documents = [ ] ;
12+
13+ for ( const [ slug , document ] of Object . entries ( docs . pages ) ) {
14+ // Extract the topic and path from the slug (format: docs/topic/path)
15+ const parts = slug . split ( '/' ) ;
16+ if ( parts . length < 3 || parts [ 0 ] !== 'docs' ) continue ;
17+
18+ const topic = parts [ 1 ] ;
19+ const path = parts . slice ( 2 ) . join ( '/' ) ;
20+
21+ documents . push ( {
22+ title : document . metadata . title ,
23+ url : `https://svelte.dev/docs/${ topic } /${ path } /llms.txt` ,
24+ use_cases : document . metadata . use_cases || undefined
25+ } ) ;
26+ }
27+
28+ return documents ;
29+ }
You can’t perform that action at this time.
0 commit comments