From 2afebf3c976f4cc47b7be9b35d6f5c0cccbc17ec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Oct 2025 01:45:21 +0000 Subject: [PATCH 1/6] Initial plan From bb1687f750aa80bd244b0afa0ae63d816bd68407 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Oct 2025 01:56:49 +0000 Subject: [PATCH 2/6] Update page titles to be more distinguishable across docs sections Co-authored-by: teemingc <54401897+teemingc@users.noreply.github.com> --- apps/svelte.dev/src/lib/server/llms.ts | 8 +++++++- .../routes/docs/[topic]/[...path]/+page.svelte | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/apps/svelte.dev/src/lib/server/llms.ts b/apps/svelte.dev/src/lib/server/llms.ts index 549d39592a..304d45c85d 100644 --- a/apps/svelte.dev/src/lib/server/llms.ts +++ b/apps/svelte.dev/src/lib/server/llms.ts @@ -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}.`; } diff --git a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte index 717ac752ec..354cdd7ca9 100644 --- a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte +++ b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte @@ -22,6 +22,16 @@ return `https://github.com/sveltejs/${name}/edit/main/documentation/${link}`; }); + // Map topic slug to readable title + const topicTitles: Record = { + svelte: 'Svelte', + kit: 'SvelteKit', + cli: 'Svelte CLI', + mcp: 'Svelte MCP' + }; + + const topicTitle = $derived(topicTitles[page.params.topic] || 'Svelte'); + onMount(() => { // hash was lowercase in v4 docs and varying case in v5 docs const hash = location.hash.slice(1); @@ -58,15 +68,15 @@ - {data.document.metadata.title} • Docs • Svelte + {data.document.metadata.title} - {topicTitle} - + - + Date: Fri, 10 Oct 2025 02:18:14 +0000 Subject: [PATCH 3/6] Use get_topic_title helper instead of duplicating logic Co-authored-by: teemingc <54401897+teemingc@users.noreply.github.com> --- .../src/routes/docs/[topic]/[...path]/+page.svelte | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte index 354cdd7ca9..6935b7eac1 100644 --- a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte +++ b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte @@ -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(); @@ -22,15 +23,7 @@ return `https://github.com/sveltejs/${name}/edit/main/documentation/${link}`; }); - // Map topic slug to readable title - const topicTitles: Record = { - svelte: 'Svelte', - kit: 'SvelteKit', - cli: 'Svelte CLI', - mcp: 'Svelte MCP' - }; - - const topicTitle = $derived(topicTitles[page.params.topic] || 'Svelte'); + const topicTitle = $derived(get_topic_title(page.params.topic)); onMount(() => { // hash was lowercase in v4 docs and varying case in v5 docs From f552ad4d46a1abd7aa37a5d8724baa14724f7b44 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 10 Oct 2025 03:39:01 +0000 Subject: [PATCH 4/6] Move topics logic to shared utils directory Co-authored-by: teemingc <54401897+teemingc@users.noreply.github.com> --- apps/svelte.dev/src/lib/server/llms.ts | 19 +++---------------- apps/svelte.dev/src/lib/utils/topics.ts | 16 ++++++++++++++++ .../docs/[topic]/[...path]/+page.svelte | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 apps/svelte.dev/src/lib/utils/topics.ts diff --git a/apps/svelte.dev/src/lib/server/llms.ts b/apps/svelte.dev/src/lib/server/llms.ts index 304d45c85d..6505e59f4f 100644 --- a/apps/svelte.dev/src/lib/server/llms.ts +++ b/apps/svelte.dev/src/lib/server/llms.ts @@ -1,6 +1,7 @@ import { minimatch } from 'minimatch'; import { dev } from '$app/environment'; import { index } from './content'; +import type { Topic } from '$lib/utils/topics'; interface GenerateLlmContentOptions { ignore?: string[]; @@ -16,11 +17,6 @@ interface MinimizeOptions { remove_prettier_ignore: boolean; } -interface Topic { - slug: string; - title: string; -} - const defaults: MinimizeOptions = { remove_legacy: false, remove_note_blocks: false, @@ -63,17 +59,8 @@ export function generate_llm_content(options: GenerateLlmContentOptions): string return content; } -export const topics: Topic[] = [ - { slug: 'svelte', title: 'Svelte' }, - { slug: 'kit', title: 'SvelteKit' }, - { 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'; -} +// Re-export from shared location for backward compatibility +export { topics, get_topic_title } from '$lib/utils/topics'; export function get_documentation_title(topic: Topic): string { return `This is the developer documentation for ${topic.title}.`; diff --git a/apps/svelte.dev/src/lib/utils/topics.ts b/apps/svelte.dev/src/lib/utils/topics.ts new file mode 100644 index 0000000000..2d51589922 --- /dev/null +++ b/apps/svelte.dev/src/lib/utils/topics.ts @@ -0,0 +1,16 @@ +export interface Topic { + slug: string; + title: string; +} + +export const topics: Topic[] = [ + { slug: 'svelte', title: 'Svelte' }, + { slug: 'kit', title: 'SvelteKit' }, + { 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'; +} diff --git a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte index 6935b7eac1..b9e1059458 100644 --- a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte +++ b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte @@ -9,7 +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'; + import { get_topic_title } from '$lib/utils/topics'; let { data } = $props(); From 917b75abeaf7caf8d799ea2e6977f1a823603190 Mon Sep 17 00:00:00 2001 From: Tee Ming Chew Date: Fri, 10 Oct 2025 12:58:54 +0800 Subject: [PATCH 5/6] doing what copilot dont --- apps/svelte.dev/src/lib/server/llms.ts | 5 +---- apps/svelte.dev/src/lib/{utils => }/topics.ts | 11 +++++++---- .../src/routes/docs/[topic]/[...path]/+page.svelte | 12 ++++++------ .../docs/[topic]/[...path]/llms.txt/+server.ts | 3 ++- apps/svelte.dev/src/routes/llms-full.txt/+server.ts | 3 ++- .../svelte.dev/src/routes/llms-medium.txt/+server.ts | 3 ++- apps/svelte.dev/src/routes/llms.txt/+server.ts | 3 ++- 7 files changed, 22 insertions(+), 18 deletions(-) rename apps/svelte.dev/src/lib/{utils => }/topics.ts (53%) diff --git a/apps/svelte.dev/src/lib/server/llms.ts b/apps/svelte.dev/src/lib/server/llms.ts index 6505e59f4f..02e7b66d1f 100644 --- a/apps/svelte.dev/src/lib/server/llms.ts +++ b/apps/svelte.dev/src/lib/server/llms.ts @@ -1,7 +1,7 @@ import { minimatch } from 'minimatch'; import { dev } from '$app/environment'; import { index } from './content'; -import type { Topic } from '$lib/utils/topics'; +import type { Topic } from '$lib/topics'; interface GenerateLlmContentOptions { ignore?: string[]; @@ -59,9 +59,6 @@ export function generate_llm_content(options: GenerateLlmContentOptions): string return content; } -// Re-export from shared location for backward compatibility -export { topics, get_topic_title } from '$lib/utils/topics'; - export function get_documentation_title(topic: Topic): string { return `This is the developer documentation for ${topic.title}.`; } diff --git a/apps/svelte.dev/src/lib/utils/topics.ts b/apps/svelte.dev/src/lib/topics.ts similarity index 53% rename from apps/svelte.dev/src/lib/utils/topics.ts rename to apps/svelte.dev/src/lib/topics.ts index 2d51589922..2b08897efb 100644 --- a/apps/svelte.dev/src/lib/utils/topics.ts +++ b/apps/svelte.dev/src/lib/topics.ts @@ -3,14 +3,17 @@ export interface Topic { title: string; } -export const topics: Topic[] = [ +export const topics = [ { slug: 'svelte', title: 'Svelte' }, { slug: 'kit', title: 'SvelteKit' }, { slug: 'cli', title: 'Svelte CLI' }, { slug: 'mcp', title: 'Svelte MCP' } -]; +] as const satisfies Topic[]; -export function get_topic_title(slug: string): string { +const DEFAULT_TITLE = 'Svelte'; + +export function get_topic_title(slug: string | undefined): string { + if (!slug) return DEFAULT_TITLE; const topic = topics.find((t) => t.slug === slug); - return topic?.title ?? 'Svelte'; + return topic?.title ?? DEFAULT_TITLE; } diff --git a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte index b9e1059458..3e5deaaaa5 100644 --- a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte +++ b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte @@ -9,7 +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/utils/topics'; + import { get_topic_title } from '$lib/topics'; let { data } = $props(); @@ -23,7 +23,7 @@ return `https://github.com/sveltejs/${name}/edit/main/documentation/${link}`; }); - const topicTitle = $derived(get_topic_title(page.params.topic)); + const topic_title = $derived(get_topic_title(page.params.topic)); onMount(() => { // hash was lowercase in v4 docs and varying case in v5 docs @@ -61,15 +61,15 @@ - {data.document.metadata.title} - {topicTitle} + {data.document.metadata.title} - {topic_title} Docs - + - + Date: Fri, 10 Oct 2025 13:03:42 +0800 Subject: [PATCH 6/6] copilot messed this up --- .../svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte index 3e5deaaaa5..2af29fa6eb 100644 --- a/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte +++ b/apps/svelte.dev/src/routes/docs/[topic]/[...path]/+page.svelte @@ -61,9 +61,9 @@ - {data.document.metadata.title} - {topic_title} Docs + {data.document.metadata.title} • {topic_title} Docs - +