Skip to content

Commit 6c5e6a7

Browse files
committed
Support changelog entries
1 parent 485420e commit 6c5e6a7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/components/overrides/Head.astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import "tippy.js/dist/tippy.css";
66
77
import { getEntry } from "astro:content";
88
import { getOgImage } from "~/util/props";
9+
import { CollectionEntry } from "astro:content";
910
1011
// grab the current top-level folder. Remove . characters for 1.1.1.1 URL
1112
const currentSection = Astro.url.pathname.split("/")[1].replaceAll(".", "");
@@ -201,7 +202,10 @@ if (Astro.props.entry.data.external_link) {
201202
});
202203
}
203204
204-
const ogImagePath = await getOgImage(Astro.props.entry);
205+
const ogImagePath = await getOgImage(
206+
(Astro.props.originalEntry as CollectionEntry<"changelog">) ??
207+
Astro.props.entry,
208+
);
205209
const ogImageUrl = new URL(ogImagePath, Astro.url.origin).toString();
206210
207211
const ogImageTags = [

src/pages/changelog/[...slug].astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const props = {
3636
headings,
3737
hideTitle: true,
3838
hideBreadcrumbs: true,
39+
originalEntry: note,
3940
} as StarlightPageProps;
4041
---
4142

src/util/props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const PRODUCT_AREA_OG_IMAGES: Record<string, string> = {
104104
"application security": "/core-services-preview.png",
105105
};
106106

107-
export async function getOgImage(entry: CollectionEntry<"docs">) {
107+
export async function getOgImage(entry: CollectionEntry<"docs" | "changelog">) {
108108
if (entry.data.cover) {
109109
if (!entry.data.cover.src) {
110110
throw new Error(

0 commit comments

Comments
 (0)