Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/svelte.dev/src/lib/server/llms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,15 @@ export function generate_llm_content(options: GenerateLlmContentOptions): string
export const topics: Topic[] = [
{ slug: 'svelte', title: 'Svelte' },
{ slug: 'kit', title: 'SvelteKit' },
{ slug: 'cli', title: 'the Svelte CLI' }
{ slug: 'cli', title: 'Svelte CLI' },
{ slug: 'mcp', title: 'Svelte MCP' }
];

export function get_topic_title(slug: string): string {
const topic = topics.find((t) => t.slug === slug);
return topic?.title ?? 'Svelte';
}

export function get_documentation_title(topic: Topic): string {
return `This is the developer documentation for ${topic.title}.`;
}
Expand Down
11 changes: 7 additions & 4 deletions apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { goto } from '$app/navigation';
import { escape_html } from '$lib/utils/escape';
import { page } from '$app/state';
import { get_topic_title } from '$lib/server/llms';

let { data } = $props();

Expand All @@ -22,6 +23,8 @@
return `https://github.com/sveltejs/${name}/edit/main/documentation/${link}`;
});

const topicTitle = $derived(get_topic_title(page.params.topic));

onMount(() => {
// hash was lowercase in v4 docs and varying case in v5 docs
const hash = location.hash.slice(1);
Expand Down Expand Up @@ -58,15 +61,15 @@
</script>

<svelte:head>
<title>{data.document.metadata.title} • Docs • Svelte</title>
<title>{data.document.metadata.title} - {topicTitle}</title>

<meta name="twitter:title" content="{data.document.metadata.title} • Docs • Svelte" />
<meta name="twitter:title" content="{data.document.metadata.title} - {topicTitle}" />
<meta
name="twitter:description"
content="{data.document.metadata.title} • Svelte documentation"
content="{data.document.metadata.title} • {topicTitle} documentation"
/>
<meta name="twitter:card" content="summary_large_image" />
<meta name="description" content="{data.document.metadata.title} • Svelte documentation" />
<meta name="description" content="{data.document.metadata.title} • {topicTitle} documentation" />
<meta
name="twitter:image"
content="https://svelte.dev/docs/{page.params.topic}/{page.params.path}/card.png"
Expand Down