Skip to content

Commit bf21ed4

Browse files
authored
[Bug] Changelog preview image (#19875)
* [Bug] Changelog preview image * Refactor logic * Update logic * remove line * move up to minimize changes
1 parent c76deef commit bf21ed4

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed

src/components/overrides/Head.astro

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ if (currentSection) {
6868
const group = product.data.product.group.toLowerCase();
6969
7070
let ogImage = "https://developers.cloudflare.com/cf-twitter-card.png";
71-
let changelogImage =
72-
"https://developers.cloudflare.com/changelog-preview.png";
71+
7372
const images: Record<string, string> = {
7473
"cloudflare essentials":
7574
"https://developers.cloudflare.com/core-services-preview.png",
@@ -88,10 +87,6 @@ if (currentSection) {
8887
ogImage = images[group];
8988
}
9089
91-
if (currentSection === "changelog") {
92-
ogImage = changelogImage;
93-
}
94-
9590
const tags = [
9691
{
9792
tag: "meta",
@@ -142,6 +137,40 @@ if (currentSection) {
142137
content: "",
143138
});
144139
}
140+
141+
if (currentSection === "changelog") {
142+
let changelogImage =
143+
"https://developers.cloudflare.com/changelog-preview.png";
144+
145+
const tags = [
146+
{
147+
tag: "meta",
148+
attrs: {
149+
name: "image",
150+
content: changelogImage,
151+
},
152+
content: "",
153+
},
154+
{
155+
tag: "meta",
156+
attrs: {
157+
name: "og:image",
158+
content: changelogImage,
159+
},
160+
content: "",
161+
},
162+
{
163+
tag: "meta",
164+
attrs: {
165+
name: "twitter:image",
166+
content: changelogImage,
167+
},
168+
content: "",
169+
},
170+
] as const;
171+
172+
Astro.props.entry.data.head.push(...tags);
173+
}
145174
}
146175
147176
// Add noindex tag if present in frontmatter

0 commit comments

Comments
 (0)