From 64af1c0dbbd95de7b51eb3614529fbd4ff1237ae Mon Sep 17 00:00:00 2001 From: eldadfux Date: Wed, 6 May 2026 23:23:53 -0400 Subject: [PATCH 1/2] fix(seo): escape JSON-LD for safe inline script embedding Thread JSON-LD can include code samples with . Escaping < as \u003c in serialized JSON prevents the HTML parser from closing script tags early in both the ld+json block and SvelteKit route data. Co-authored-by: Cursor --- src/lib/utils/metadata.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/lib/utils/metadata.ts b/src/lib/utils/metadata.ts index 3a2aadb28e2..ecb441f8b04 100644 --- a/src/lib/utils/metadata.ts +++ b/src/lib/utils/metadata.ts @@ -13,15 +13,21 @@ export function buildOpenGraphImage(title: string, description: string): string )}&subtitle=${encodeURIComponent(description)}`; } +/** + * Escapes `<` as the JSON unicode escape `\u003c` so the result can be embedded + * inside HTML `` + * or similar sequences in string values ending the script early. `JSON.parse` + * still yields the original `<`. + */ +export function escapeJsonLtForHtmlScript(json: string): string { + return json.replace(/` inside string values - * (e.g. code samples in forum posts) cannot prematurely close the script element - * in HTML; JSON.parse still yields the original `<`. */ export function getInlinedScriptTag(jsonSchema: string): string { - const safeForInlineScript = jsonSchema.replace(/${safeForInlineScript}'; } @@ -43,7 +49,7 @@ export function organizationJsonSchema() { legalName: 'Appwrite Code Ltd.', description: 'A secure open-source backend server provides the core APIs required to build web and mobile applications. Appwrite provides authentication, database, storage, functions, messaging, and advanced realtime capabilities.', - logo: 'https://appwrite.io/assets/logotype/white.avif' + logo: 'https://appwrite.io/assets/logotype/white.png' }); } @@ -246,5 +252,5 @@ export function createDiscussionForumPageSchema(options: { mainEntity }; - return JSON.stringify(graph); + return escapeJsonLtForHtmlScript(JSON.stringify(graph)); } From 15b420ab058f82d523210c72d4311e0b05495075 Mon Sep 17 00:00:00 2001 From: eldadfux Date: Thu, 7 May 2026 09:55:01 -0400 Subject: [PATCH 2/2] feat(marketing): enhance hero section with dynamic title and query resolution - Added support for dynamic hero titles in the marketing page by resolving query parameters. - Introduced new constants for default hero attributes and integrated them into the page logic. - Updated the layout to ensure the document title reflects the hero heading accurately. This improves the SEO and user experience by providing relevant titles based on user context. --- src/routes/(marketing)/+page.svelte | 33 ++++++++++++++++++++++++++-- src/routes/threads/[id]/+page.svelte | 2 +- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/routes/(marketing)/+page.svelte b/src/routes/(marketing)/+page.svelte index 6112d4d625d..39e5d4162b2 100644 --- a/src/routes/(marketing)/+page.svelte +++ b/src/routes/(marketing)/+page.svelte @@ -1,5 +1,14 @@ diff --git a/src/routes/threads/[id]/+page.svelte b/src/routes/threads/[id]/+page.svelte index 80a59c5e89d..af2affe3f8b 100644 --- a/src/routes/threads/[id]/+page.svelte +++ b/src/routes/threads/[id]/+page.svelte @@ -138,7 +138,7 @@ display: grid; grid-template-columns: 1fr auto; gap: 4rem; - align-items: center; + align-items: start; margin-block-start: 2.5rem; }