File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
routes/docs/[topic]/[...path] Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -66,9 +66,15 @@ export function generate_llm_content(options: GenerateLlmContentOptions): string
6666export const topics : Topic [ ] = [
6767 { slug : 'svelte' , title : 'Svelte' } ,
6868 { slug : 'kit' , title : 'SvelteKit' } ,
69- { slug : 'cli' , title : 'the Svelte CLI' }
69+ { slug : 'cli' , title : 'Svelte CLI' } ,
70+ { slug : 'mcp' , title : 'Svelte MCP' }
7071] ;
7172
73+ export function get_topic_title ( slug : string ) : string {
74+ const topic = topics . find ( ( t ) => t . slug === slug ) ;
75+ return topic ?. title ?? 'Svelte' ;
76+ }
77+
7278export function get_documentation_title ( topic : Topic ) : string {
7379 return `This is the developer documentation for ${ topic . title } .` ;
7480}
Original file line number Diff line number Diff line change 2222 return ` https://github.com/sveltejs/${name }/edit/main/documentation/${link } ` ;
2323 });
2424
25+ // Map topic slug to readable title
26+ const topicTitles: Record <string , string > = {
27+ svelte: ' Svelte' ,
28+ kit: ' SvelteKit' ,
29+ cli: ' Svelte CLI' ,
30+ mcp: ' Svelte MCP'
31+ };
32+
33+ const topicTitle = $derived (topicTitles [page .params .topic ] || ' Svelte' );
34+
2535 onMount (() => {
2636 // hash was lowercase in v4 docs and varying case in v5 docs
2737 const hash = location .hash .slice (1 );
5868 </script >
5969
6070<svelte:head >
61- <title >{data .document .metadata .title } • Docs • Svelte </title >
71+ <title >{data .document .metadata .title } - { topicTitle } </title >
6272
63- <meta name ="twitter:title" content =" {data .document .metadata .title } • Docs • Svelte " />
73+ <meta name ="twitter:title" content =" {data .document .metadata .title } - { topicTitle } " />
6474 <meta
6575 name =" twitter:description"
66- content =" {data .document .metadata .title } • Svelte documentation"
76+ content =" {data .document .metadata .title } • { topicTitle } documentation"
6777 />
6878 <meta name =" twitter:card" content =" summary_large_image" />
69- <meta name ="description" content =" {data .document .metadata .title } • Svelte documentation" />
79+ <meta name ="description" content =" {data .document .metadata .title } • { topicTitle } documentation" />
7080 <meta
7181 name =" twitter:image"
7282 content ="https://svelte.dev/docs/ {page .params .topic }/ {page .params .path }/card.png"
You can’t perform that action at this time.
0 commit comments