Skip to content

Commit 5c933c6

Browse files
authored
[Changelog] Metadata values (#23934)
* [Changelog] Metadata values * Hacky workaround (for now) * Fix failure * slight refactor * partial * Refactor code for clarity * remove logging * remove other random value * update * update tests * bug
1 parent b18ac51 commit 5c933c6

File tree

21 files changed

+91
-56
lines changed

21 files changed

+91
-56
lines changed

src/components/overrides/Head.astro

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,44 @@ const shouldChatbotDeprioritize =
2929
frontmatter.sidebar.hidden ||
3030
frontmatter.chatbot_deprioritize;
3131
32+
// if not a top-level page, add metadata values from src/content/products/ entries
3233
if (currentSection) {
33-
const product = await getEntry("products", currentSection);
34+
// if entry for product, grab and proceed
35+
let product = await getEntry("products", currentSection);
36+
// if entry for changelog, grab the first product value (which corresponds to the folder the entry is in) and use as the primary "product"
37+
if (currentSection === "changelog") {
38+
const products = frontmatter.products
39+
if (products) {
40+
product = await getEntry("products", products[0]);
41+
}
42+
}
3443
3544
if (product) {
36-
if (product.data.meta.title) {
37-
const titleIdx = head.findIndex((x) => x.tag === "title");
45+
let productMetaName = product.data.meta.title ? product.data.meta.title : "Cloudflare Docs";
46+
47+
if (currentSection === "changelog") {
48+
productMetaName = "Changelog"
49+
}
3850
39-
let title: string;
51+
const titleIdx = head.findIndex((x) => x.tag === "title");
52+
let title: string;
4053
41-
if (titleIdx !== -1) {
42-
const existingTitle = head[titleIdx].content?.split(
54+
// Prefer the title set via frontmatter.head.title. If not, grab the regular frontmatter title value.
55+
const existingTitle = head[titleIdx].content ? head[titleIdx].content?.split(
4356
` ${DEFAULT_TITLE_DELIMITER} `,
44-
)[0];
45-
title = `${existingTitle} · ${product.data.meta.title}`;
46-
47-
head[titleIdx] = {
48-
tag: "title",
49-
content: title,
50-
};
51-
} else {
52-
title = `${frontmatter.title} · ${product.data.meta.title}`;
53-
head.push({
54-
tag: "title",
55-
content: title,
56-
});
57-
}
57+
)[0]: frontmatter.title;
5858
59-
metaTags.push({
60-
property: "og:title",
61-
content: title,
62-
});
63-
}
59+
title = `${existingTitle} · ${productMetaName}`;
60+
61+
head[titleIdx] = {
62+
tag: "title",
63+
content: title,
64+
};
65+
66+
metaTags.push({
67+
property: "og:title",
68+
content: title,
69+
});
6470
6571
if (product.data.product.title) {
6672
["pcx_product", "algolia_product_filter"].map((name) => {
@@ -122,9 +128,11 @@ if (
122128
123129
if (frontmatter.pcx_content_type) {
124130
["pcx_content_type", "algolia_content_type"].map((name) => {
131+
const contentType = frontmatter.pcx_content_type
132+
const updatedName = contentType ? (contentType.charAt(0).toUpperCase() + contentType.slice(1)).replace("-", " ") : ""
125133
metaTags.push({
126134
name,
127-
content: frontmatter.pcx_content_type as string,
135+
content: updatedName,
128136
});
129137
});
130138
}
@@ -209,6 +217,7 @@ metaTags.map((attrs) => {
209217
attrs,
210218
});
211219
});
220+
212221
---
213222

214223
<script src="src/scripts/footnotes.ts"></script>

src/content/changelog/audit-logs/2025-03-27-automatic-audit-logs-beta-release.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Audit logs (version 2) - Beta Release
33
description: New version of audit logs
44
date: 2025-03-27
55
---
6+
67
The latest version of audit logs streamlines audit logging by automatically capturing all user and system actions performed through the Cloudflare Dashboard or public APIs. This update leverages Cloudflare’s existing API Shield to generate audit logs based on OpenAPI schemas, ensuring a more consistent and automated logging process.
78

89
Availability: Audit logs (version 2) is now in Beta, with support limited to **API access**.

src/content/docs/autorag/platform/release-note.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
pcx_content_type: Release notes
2+
pcx_content_type: release-notes
33
title: Release note
44
release_notes_file_name:
55
- autorag

src/content/docs/hyperdrive/examples/connect-to-mysql/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
type: overview
3-
pcx_content_type: content
3+
pcx_content_type: example
44
title: Connect to MySQL
55
hideChildren: false
66
sidebar:

src/content/docs/logs/logpush/logpush-job/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
pcx_content_type: how-tp
2+
pcx_content_type: navigation
33
title: Logpush job setup
44
sidebar:
55
order: 2

src/content/docs/turnstile/migration/hcaptcha.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Migrate from hCaptcha
3-
pcx_content_type: migration
3+
pcx_content_type: how-to
44
sidebar:
55
order: 2
66

src/content/docs/turnstile/migration/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Migration
3-
pcx_content_type: migration
3+
pcx_content_type: navigation
44
sidebar:
55
order: 2
66
---

src/content/docs/turnstile/migration/recaptcha.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Migrate from reCAPTCHA
3-
pcx_content_type: migration
3+
pcx_content_type: how-to
44
sidebar:
55
order: 1
66

src/content/docs/workers/languages/python/examples.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
pcx_content_type: content
2+
pcx_content_type: example
33
title: Examples
44
head:
55
- tag: title

src/content/docs/workers/languages/python/ffi.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
pcx_content_type: content
2+
pcx_content_type: reference
33
title: Foreign Function Interface (FFI)
44
head:
55
- tag: title

0 commit comments

Comments
 (0)