Skip to content

Commit bb1687f

Browse files
Copilotteemingc
andcommitted
Update page titles to be more distinguishable across docs sections
Co-authored-by: teemingc <[email protected]>
1 parent 2afebf3 commit bb1687f

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

apps/svelte.dev/src/lib/server/llms.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,15 @@ export function generate_llm_content(options: GenerateLlmContentOptions): string
6666
export 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+
7278
export function get_documentation_title(topic: Topic): string {
7379
return `This is the developer documentation for ${topic.title}.`;
7480
}

apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@
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);
@@ -58,15 +68,15 @@
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"

0 commit comments

Comments
 (0)