Skip to content

Commit 793cd0e

Browse files
DarthGigiclaude
andcommitted
fix(newsroom): render social embeds as large-image cards
Wire the `/newsroom` listing and `/newsroom/<slug>` posts to emit `twitter:card=summary_large_image`, set `og:image` to the post's hero variant (and a branded graphic on the listing), and exclude the routes from the layout-level SvelteSeo so the homepage defaults stop bleeding into the embed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a728a11 commit 793cd0e

5 files changed

Lines changed: 33 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"skycrypt-frontend": patch
3+
---
4+
5+
Render newsroom posts and the listing page as `summary_large_image` social embeds with the post's hero image (or a branded graphic on the listing), and stop the homepage SEO defaults from leaking into them.

src/routes/+layout.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
const internalState = initInternalState();
3838
const position = writable<ToasterProps["position"]>("bottom-right");
3939
const theme = writable<ToasterProps["theme"]>("dark");
40-
const noEmbedUrls = ["/stats/"];
40+
const noEmbedUrls = ["/stats/", "/newsroom"];
4141
const packs = new PacksContext();
4242
const websiteJsonLd = {
4343
"@context": "https://schema.org",

src/routes/newsroom/+page.svelte

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,24 @@
2828
afterNavigate(markVisiblePostsSeen);
2929
</script>
3030

31-
<SvelteSeo title="Newsroom | SkyCrypt" description="Latest announcements and updates from the SkyCrypt team" canonical="https://sky.shiiyu.moe/newsroom" />
31+
<SvelteSeo
32+
title="Newsroom | SkyCrypt"
33+
description="Latest announcements and updates from the SkyCrypt team"
34+
canonical="https://sky.shiiyu.moe/newsroom"
35+
openGraph={{
36+
type: "website",
37+
title: "Newsroom | SkyCrypt",
38+
description: "Latest announcements and updates from the SkyCrypt team",
39+
site_name: "SkyCrypt",
40+
images: [{ url: "https://sky.shiiyu.moe/img/newsroom.avif", width: 1200, height: 630, alt: "SkyCrypt Newsroom" }]
41+
}}
42+
twitter={{
43+
card: "summary_large_image",
44+
title: "Newsroom | SkyCrypt",
45+
description: "Latest announcements and updates from the SkyCrypt team",
46+
image: "https://sky.shiiyu.moe/img/newsroom.avif",
47+
imageAlt: "SkyCrypt Newsroom"
48+
}} />
3249

3350
<main class="@container mx-auto flex max-w-272 flex-col gap-6 pt-5 pr-[max(1.25rem,env(safe-area-inset-right))] pb-[max(1.25rem,env(safe-area-inset-bottom))] pl-[max(1.25rem,env(safe-area-inset-left))]">
3451
<div class={cn("flex flex-col gap-4 rounded-lg p-5 @md:flex-row @md:items-center @md:justify-between", preferences.performanceMode ? "bg-background-grey" : "backdrop-blur-lg backdrop-brightness-150 backdrop-contrast-60 dark:backdrop-brightness-50 dark:backdrop-contrast-100")}>

src/routes/newsroom/[slug]/+page.svelte

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
const heroHeight = $derived(post.heroImage?.sizes?.hero?.height ?? post.heroImage?.height ?? undefined);
4949
const heroAlt = $derived(post.heroImage?.alt ?? post.title);
5050
51-
const ogImages = $derived(post.heroImage?.url ? [{ url: post.heroImage.url, width: post.heroImage.width ?? undefined, height: post.heroImage.height ?? undefined, alt: post.heroImage.alt ?? post.title }] : []);
51+
const ogImages = $derived(heroSrc ? [{ url: heroSrc, width: heroWidth, height: heroHeight, alt: heroAlt }] : []);
5252
5353
const containerClass = $derived(cn("rounded-lg", preferences.performanceMode ? "bg-background-grey" : "backdrop-blur-lg backdrop-brightness-150 backdrop-contrast-60 dark:backdrop-brightness-50 dark:backdrop-contrast-100"));
5454
@@ -67,11 +67,19 @@
6767
type: "article",
6868
title: post.title,
6969
description: post.excerpt ?? post.title,
70+
site_name: "SkyCrypt",
7071
images: ogImages,
7172
article: {
7273
published_time: post.publishedAt ?? undefined,
7374
author: [displayName]
7475
}
76+
}}
77+
twitter={{
78+
card: "summary_large_image",
79+
title: post.title,
80+
description: post.excerpt ?? post.title,
81+
image: heroSrc ?? undefined,
82+
imageAlt: heroAlt
7583
}} />
7684

7785
<article class="mx-auto flex max-w-3xl flex-col gap-6 px-[max(1.25rem,env(safe-area-inset-right))] py-8">

static/img/newsroom.avif

411 KB
Binary file not shown.

0 commit comments

Comments
 (0)