Skip to content

Commit d79c91a

Browse files
fix(og): fix Twitter image size, improve type-safety
1 parent 7614446 commit d79c91a

File tree

7 files changed

+34
-19
lines changed

7 files changed

+34
-19
lines changed

src/routes/+layout.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function load({ url, data }) {
2020
return {
2121
...data,
2222
siteName,
23-
baseMetaTags: Object.freeze({
23+
baseMetaTags: Object.freeze<MetaTagsProps>({
2424
title: "Loading...",
2525
titleTemplate: `%s | ${siteName}`,
2626
description: "A nice UI to stay up-to-date with Svelte releases",
@@ -41,13 +41,13 @@ export function load({ url, data }) {
4141
},
4242
twitter: {
4343
creator: "@probably_coding",
44-
cardType: "summary" as const,
44+
cardType: "summary",
4545
description: "A nice UI to stay up-to-date with Svelte releases"
4646
},
4747
keywords: ["svelte", "changelog", "svelte changelog", "sveltekit"],
4848
additionalRobotsProps: {
4949
noarchive: true
5050
}
51-
}) satisfies MetaTagsProps
51+
})
5252
};
5353
}

src/routes/[pid=pid]/[org]/[repo]/[id=number]/+page.server.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { publicRepos } from "$lib/repositories";
44
import { githubCache } from "$lib/server/github-cache";
55
import type { BranchCommit } from "$lib/types";
66

7+
type Type = "pull" | "issue" | "discussion";
8+
79
export async function load({ params, fetch }) {
810
const { pid: type, org, repo, id } = params;
911
const numId = +id; // id is already validated by the route matcher
@@ -25,12 +27,10 @@ export async function load({ params, fetch }) {
2527
org,
2628
repo,
2729
id: numId,
28-
type:
29-
type === "issues"
30-
? ("issue" as const)
31-
: type === "discussions"
32-
? ("discussion" as const)
33-
: ("pull" as const)
30+
type: type === "issues" ? "issue" : type === "discussions" ? "discussion" : type
31+
} satisfies {
32+
type: Type;
33+
[key: string]: unknown;
3434
},
3535
item,
3636
mergedTagName: new Promise<[string, string] | undefined>((resolve, reject) => {

src/routes/[pid=pid]/[org]/[repo]/[id=number]/+page.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { MetaTagsProps } from "svelte-meta-tags";
33
export function load({ data, url }) {
44
return {
55
...data,
6-
pageMetaTags: Object.freeze({
6+
pageMetaTags: Object.freeze<MetaTagsProps>({
77
title: `Detail of ${data.itemMetadata.org}/${data.itemMetadata.repo}#${data.itemMetadata.id}`,
88
openGraph: {
99
images: [
@@ -19,7 +19,10 @@ export function load({ data, url }) {
1919
}
2020
}
2121
]
22+
},
23+
twitter: {
24+
cardType: "summary_large_image"
2225
}
23-
}) satisfies MetaTagsProps
26+
})
2427
};
2528
}

src/routes/devlog/v2/+page.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { MetaTagsProps } from "svelte-meta-tags";
22

33
export function load({ url }) {
44
return {
5-
pageMetaTags: Object.freeze({
5+
pageMetaTags: Object.freeze<MetaTagsProps>({
66
title: "v2 • Devlog",
77
description: "The development blog of Svelte Changelog",
88
openGraph: {
@@ -15,7 +15,10 @@ export function load({ url }) {
1515
}
1616
}
1717
]
18+
},
19+
twitter: {
20+
cardType: "summary_large_image"
1821
}
19-
}) satisfies MetaTagsProps
22+
})
2023
};
2124
}

src/routes/package/[...package]/+page.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { MetaTagsProps } from "svelte-meta-tags";
33
export function load({ data, url }) {
44
return {
55
...data,
6-
pageMetaTags: Object.freeze({
6+
pageMetaTags: Object.freeze<MetaTagsProps>({
77
title: data.currentPackage.pkg.name,
88
openGraph: {
99
images: [
@@ -19,7 +19,10 @@ export function load({ data, url }) {
1919
}
2020
}
2121
]
22+
},
23+
twitter: {
24+
cardType: "summary_large_image"
2225
}
23-
}) satisfies MetaTagsProps
26+
})
2427
};
2528
}

src/routes/packages/+page.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { MetaTagsProps } from "svelte-meta-tags";
33
export function load({ data, url }) {
44
return {
55
...data,
6-
pageMetaTags: Object.freeze({
6+
pageMetaTags: Object.freeze<MetaTagsProps>({
77
title: "All Packages",
88
openGraph: {
99
images: [
@@ -15,7 +15,10 @@ export function load({ data, url }) {
1515
}
1616
}
1717
]
18+
},
19+
twitter: {
20+
cardType: "summary_large_image"
1821
}
19-
}) satisfies MetaTagsProps
22+
})
2023
};
2124
}

src/routes/tracker/[org]/[repo]/+page.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { MetaTagsProps } from "svelte-meta-tags";
33
export function load({ data, params, url }) {
44
return {
55
...data,
6-
pageMetaTags: Object.freeze({
6+
pageMetaTags: Object.freeze<MetaTagsProps>({
77
title: `Tracker for ${params.org}/${params.repo}`,
88
openGraph: {
99
images: [
@@ -15,7 +15,10 @@ export function load({ data, params, url }) {
1515
}
1616
}
1717
]
18+
},
19+
twitter: {
20+
cardType: "summary_large_image"
1821
}
19-
}) satisfies MetaTagsProps
22+
})
2023
};
2124
}

0 commit comments

Comments
 (0)