Skip to content

Commit 44419ea

Browse files
committed
Update logic
1 parent 6327f4c commit 44419ea

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

src/components/overrides/Head.astro

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ if (currentSection) {
6565
}
6666
6767
let ogImage = "https://developers.cloudflare.com/cf-twitter-card.png";
68-
let changelogImage =
69-
"https://developers.cloudflare.com/changelog-preview.png";
7068
7169
if (product.data.product.group) {
7270
const group = product.data.product.group.toLowerCase();
@@ -99,10 +97,6 @@ if (currentSection) {
9997
});
10098
}
10199
102-
if (currentSection === "changelog") {
103-
ogImage = changelogImage;
104-
}
105-
106100
const tags = [
107101
{
108102
tag: "meta",
@@ -143,6 +137,40 @@ if (currentSection) {
143137
content: "",
144138
});
145139
}
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+
}
146174
}
147175
148176
// Add noindex tag if present in frontmatter

0 commit comments

Comments
 (0)