File tree Expand file tree Collapse file tree 7 files changed +22
-18
lines changed Expand file tree Collapse file tree 7 files changed +22
-18
lines changed Original file line number Diff line number Diff line change 11import { minimatch } from 'minimatch' ;
22import { dev } from '$app/environment' ;
33import { index } from './content' ;
4- import type { Topic } from '$lib/utils/ topics' ;
4+ import type { Topic } from '$lib/topics' ;
55
66interface GenerateLlmContentOptions {
77 ignore ?: string [ ] ;
@@ -59,9 +59,6 @@ export function generate_llm_content(options: GenerateLlmContentOptions): string
5959 return content ;
6060}
6161
62- // Re-export from shared location for backward compatibility
63- export { topics , get_topic_title } from '$lib/utils/topics' ;
64-
6562export function get_documentation_title ( topic : Topic ) : string {
6663 return `This is the developer documentation for ${ topic . title } .` ;
6764}
Original file line number Diff line number Diff line change @@ -3,14 +3,17 @@ export interface Topic {
33 title : string ;
44}
55
6- export const topics : Topic [ ] = [
6+ export const topics = [
77 { slug : 'svelte' , title : 'Svelte' } ,
88 { slug : 'kit' , title : 'SvelteKit' } ,
99 { slug : 'cli' , title : 'Svelte CLI' } ,
1010 { slug : 'mcp' , title : 'Svelte MCP' }
11- ] ;
11+ ] as const satisfies Topic [ ] ;
1212
13- export function get_topic_title ( slug : string ) : string {
13+ const DEFAULT_TITLE = 'Svelte' ;
14+
15+ export function get_topic_title ( slug : string | undefined ) : string {
16+ if ( ! slug ) return DEFAULT_TITLE ;
1417 const topic = topics . find ( ( t ) => t . slug === slug ) ;
15- return topic ?. title ?? 'Svelte' ;
18+ return topic ?. title ?? DEFAULT_TITLE ;
1619}
Original file line number Diff line number Diff line change 99 import { goto } from ' $app/navigation' ;
1010 import { escape_html } from ' $lib/utils/escape' ;
1111 import { page } from ' $app/state' ;
12- import { get_topic_title } from ' $lib/utils/ topics' ;
12+ import { get_topic_title } from ' $lib/topics' ;
1313
1414 let { data } = $props ();
1515
2323 return ` https://github.com/sveltejs/${name }/edit/main/documentation/${link } ` ;
2424 });
2525
26- const topicTitle = $derived (get_topic_title (page .params .topic ));
26+ const topic_title = $derived (get_topic_title (page .params .topic ));
2727
2828 onMount (() => {
2929 // hash was lowercase in v4 docs and varying case in v5 docs
6161 </script >
6262
6363<svelte:head >
64- <title >{data .document .metadata .title } - {topicTitle } </title >
64+ <title >{data .document .metadata .title } - {topic_title } Docs </title >
6565
66- <meta name ="twitter:title" content =" {data .document .metadata .title } - {topicTitle } " />
66+ <meta name ="twitter:title" content =" {data .document .metadata .title } - {topic_title } Docs " />
6767 <meta
6868 name =" twitter:description"
69- content =" {data .document .metadata .title } • {topicTitle } documentation"
69+ content =" {data .document .metadata .title } • {topic_title } documentation"
7070 />
7171 <meta name =" twitter:card" content =" summary_large_image" />
72- <meta name ="description" content =" {data .document .metadata .title } • {topicTitle } documentation" />
72+ <meta name ="description" content =" {data .document .metadata .title } • {topic_title } documentation" />
7373 <meta
7474 name =" twitter:image"
7575 content ="https://svelte.dev/docs/ {page .params .topic }/ {page .params .path }/card.png"
Original file line number Diff line number Diff line change 11import { error } from '@sveltejs/kit' ;
22import { docs } from '$lib/server/content.js' ;
3- import { generate_llm_content , get_documentation_title , topics } from '$lib/server/llms' ;
3+ import { generate_llm_content , get_documentation_title } from '$lib/server/llms' ;
4+ import { topics } from '$lib/topics' ;
45
56export const prerender = true ;
67
Original file line number Diff line number Diff line change 1- import { generate_llm_content , topics } from '$lib/server/llms' ;
1+ import { generate_llm_content } from '$lib/server/llms' ;
2+ import { topics } from '$lib/topics' ;
23
34export const prerender = true ;
45
Original file line number Diff line number Diff line change 1- import { generate_llm_content , topics } from '$lib/server/llms' ;
1+ import { generate_llm_content } from '$lib/server/llms' ;
2+ import { topics } from '$lib/topics' ;
23
34export function GET ( ) {
45 const main_content = generate_llm_content ( {
Original file line number Diff line number Diff line change 1- import { get_documentation_title , topics } from '$lib/server/llms' ;
1+ import { get_documentation_title } from '$lib/server/llms' ;
2+ import { topics } from '$lib/topics' ;
23import template from './template.md?raw' ;
34
45const DOMAIN = `https://svelte.dev` ;
You can’t perform that action at this time.
0 commit comments