diff --git a/src/components/overrides/Head.astro b/src/components/overrides/Head.astro index 002d1af64b61e4f..fa44c498bb54d09 100644 --- a/src/components/overrides/Head.astro +++ b/src/components/overrides/Head.astro @@ -29,38 +29,44 @@ const shouldChatbotDeprioritize = frontmatter.sidebar.hidden || frontmatter.chatbot_deprioritize; +// if not a top-level page, add metadata values from src/content/products/ entries if (currentSection) { - const product = await getEntry("products", currentSection); + // if entry for product, grab and proceed + let product = await getEntry("products", currentSection); + // if entry for changelog, grab the first product value (which corresponds to the folder the entry is in) and use as the primary "product" + if (currentSection === "changelog") { + const products = frontmatter.products + if (products) { + product = await getEntry("products", products[0]); + } + } if (product) { - if (product.data.meta.title) { - const titleIdx = head.findIndex((x) => x.tag === "title"); + let productMetaName = product.data.meta.title ? product.data.meta.title : "Cloudflare Docs"; + + if (currentSection === "changelog") { + productMetaName = "Changelog" + } - let title: string; + const titleIdx = head.findIndex((x) => x.tag === "title"); + let title: string; - if (titleIdx !== -1) { - const existingTitle = head[titleIdx].content?.split( + // Prefer the title set via frontmatter.head.title. If not, grab the regular frontmatter title value. + const existingTitle = head[titleIdx].content ? head[titleIdx].content?.split( ` ${DEFAULT_TITLE_DELIMITER} `, - )[0]; - title = `${existingTitle} · ${product.data.meta.title}`; - - head[titleIdx] = { - tag: "title", - content: title, - }; - } else { - title = `${frontmatter.title} · ${product.data.meta.title}`; - head.push({ - tag: "title", - content: title, - }); - } + )[0]: frontmatter.title; - metaTags.push({ - property: "og:title", - content: title, - }); - } + title = `${existingTitle} · ${productMetaName}`; + + head[titleIdx] = { + tag: "title", + content: title, + }; + + metaTags.push({ + property: "og:title", + content: title, + }); if (product.data.product.title) { ["pcx_product", "algolia_product_filter"].map((name) => { @@ -122,9 +128,11 @@ if ( if (frontmatter.pcx_content_type) { ["pcx_content_type", "algolia_content_type"].map((name) => { + const contentType = frontmatter.pcx_content_type + const updatedName = contentType ? (contentType.charAt(0).toUpperCase() + contentType.slice(1)).replace("-", " ") : "" metaTags.push({ name, - content: frontmatter.pcx_content_type as string, + content: updatedName, }); }); } @@ -209,6 +217,7 @@ metaTags.map((attrs) => { attrs, }); }); + --- diff --git a/src/content/changelog/audit-logs/2025-03-27-automatic-audit-logs-beta-release.mdx b/src/content/changelog/audit-logs/2025-03-27-automatic-audit-logs-beta-release.mdx index be90d517dc75b29..a63a4883e33a5be 100644 --- a/src/content/changelog/audit-logs/2025-03-27-automatic-audit-logs-beta-release.mdx +++ b/src/content/changelog/audit-logs/2025-03-27-automatic-audit-logs-beta-release.mdx @@ -3,6 +3,7 @@ title: Audit logs (version 2) - Beta Release description: New version of audit logs date: 2025-03-27 --- + 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. Availability: Audit logs (version 2) is now in Beta, with support limited to **API access**. diff --git a/src/content/docs/autorag/platform/release-note.mdx b/src/content/docs/autorag/platform/release-note.mdx index 96487b8e0a33f0b..88c9e1a5ab20d80 100644 --- a/src/content/docs/autorag/platform/release-note.mdx +++ b/src/content/docs/autorag/platform/release-note.mdx @@ -1,5 +1,5 @@ --- -pcx_content_type: Release notes +pcx_content_type: release-notes title: Release note release_notes_file_name: - autorag diff --git a/src/content/docs/hyperdrive/examples/connect-to-mysql/index.mdx b/src/content/docs/hyperdrive/examples/connect-to-mysql/index.mdx index f1da4356b4b152c..4879f3d030bfd7b 100644 --- a/src/content/docs/hyperdrive/examples/connect-to-mysql/index.mdx +++ b/src/content/docs/hyperdrive/examples/connect-to-mysql/index.mdx @@ -1,6 +1,6 @@ --- type: overview -pcx_content_type: content +pcx_content_type: example title: Connect to MySQL hideChildren: false sidebar: diff --git a/src/content/docs/logs/logpush/logpush-job/index.mdx b/src/content/docs/logs/logpush/logpush-job/index.mdx index 0ff0d1aef84ca46..7aaf6d587121dd7 100644 --- a/src/content/docs/logs/logpush/logpush-job/index.mdx +++ b/src/content/docs/logs/logpush/logpush-job/index.mdx @@ -1,5 +1,5 @@ --- -pcx_content_type: how-tp +pcx_content_type: navigation title: Logpush job setup sidebar: order: 2 diff --git a/src/content/docs/turnstile/migration/hcaptcha.mdx b/src/content/docs/turnstile/migration/hcaptcha.mdx index 4a406ed880d3967..5c6f400f15790ac 100644 --- a/src/content/docs/turnstile/migration/hcaptcha.mdx +++ b/src/content/docs/turnstile/migration/hcaptcha.mdx @@ -1,6 +1,6 @@ --- title: Migrate from hCaptcha -pcx_content_type: migration +pcx_content_type: how-to sidebar: order: 2 diff --git a/src/content/docs/turnstile/migration/index.mdx b/src/content/docs/turnstile/migration/index.mdx index 5e7d3a34537ca96..31497c9f30d3215 100644 --- a/src/content/docs/turnstile/migration/index.mdx +++ b/src/content/docs/turnstile/migration/index.mdx @@ -1,6 +1,6 @@ --- title: Migration -pcx_content_type: migration +pcx_content_type: navigation sidebar: order: 2 --- diff --git a/src/content/docs/turnstile/migration/recaptcha.mdx b/src/content/docs/turnstile/migration/recaptcha.mdx index 736e3891720d9e6..443b324b8cc0a0c 100644 --- a/src/content/docs/turnstile/migration/recaptcha.mdx +++ b/src/content/docs/turnstile/migration/recaptcha.mdx @@ -1,6 +1,6 @@ --- title: Migrate from reCAPTCHA -pcx_content_type: migration +pcx_content_type: how-to sidebar: order: 1 diff --git a/src/content/docs/use-cases/ai.mdx b/src/content/docs/use-cases/ai.mdx index 2da69992a5ad2b6..3ab10e940d1169d 100644 --- a/src/content/docs/use-cases/ai.mdx +++ b/src/content/docs/use-cases/ai.mdx @@ -1,5 +1,5 @@ --- -pcx_content_type: use_case +pcx_content_type: overview title: Build AI Applications head: - tag: title diff --git a/src/content/docs/workers/languages/python/examples.mdx b/src/content/docs/workers/languages/python/examples.mdx index a083955863c2683..1cf0f80c1186bfd 100644 --- a/src/content/docs/workers/languages/python/examples.mdx +++ b/src/content/docs/workers/languages/python/examples.mdx @@ -1,5 +1,5 @@ --- -pcx_content_type: content +pcx_content_type: example title: Examples head: - tag: title diff --git a/src/content/docs/workers/languages/python/ffi.mdx b/src/content/docs/workers/languages/python/ffi.mdx index f8ff1e67299a2d7..b8f994c49e00a1b 100644 --- a/src/content/docs/workers/languages/python/ffi.mdx +++ b/src/content/docs/workers/languages/python/ffi.mdx @@ -1,5 +1,5 @@ --- -pcx_content_type: content +pcx_content_type: reference title: Foreign Function Interface (FFI) head: - tag: title diff --git a/src/content/docs/workers/languages/python/how-python-workers-work.mdx b/src/content/docs/workers/languages/python/how-python-workers-work.mdx index 2318c4cce0d3f15..9c4c7bad165139d 100644 --- a/src/content/docs/workers/languages/python/how-python-workers-work.mdx +++ b/src/content/docs/workers/languages/python/how-python-workers-work.mdx @@ -1,5 +1,5 @@ --- -pcx_content_type: content +pcx_content_type: concept title: How Python Workers Work sidebar: order: 1 diff --git a/src/content/docs/workers/languages/python/packages/fastapi.mdx b/src/content/docs/workers/languages/python/packages/fastapi.mdx index b57cd40b4623050..2e8f6b80bc596f1 100644 --- a/src/content/docs/workers/languages/python/packages/fastapi.mdx +++ b/src/content/docs/workers/languages/python/packages/fastapi.mdx @@ -1,5 +1,5 @@ --- -pcx_content_type: content +pcx_content_type: reference title: FastAPI head: - tag: title diff --git a/src/content/docs/workers/languages/python/packages/langchain.mdx b/src/content/docs/workers/languages/python/packages/langchain.mdx index f67b14de02d15ad..497340e50e2ec5f 100644 --- a/src/content/docs/workers/languages/python/packages/langchain.mdx +++ b/src/content/docs/workers/languages/python/packages/langchain.mdx @@ -1,5 +1,5 @@ --- -pcx_content_type: content +pcx_content_type: reference title: Langchain head: - tag: title diff --git a/src/content/docs/workers/languages/python/stdlib.mdx b/src/content/docs/workers/languages/python/stdlib.mdx index 4f6ecb51f8720e7..e2b997708bff453 100644 --- a/src/content/docs/workers/languages/python/stdlib.mdx +++ b/src/content/docs/workers/languages/python/stdlib.mdx @@ -1,5 +1,5 @@ --- -pcx_content_type: content +pcx_content_type: reference title: Standard Library sidebar: order: 3 diff --git a/src/content/docs/workflows/build/local-development.mdx b/src/content/docs/workflows/build/local-development.mdx index a72947b9fd234e4..9ae0959a8c3d8c2 100644 --- a/src/content/docs/workflows/build/local-development.mdx +++ b/src/content/docs/workflows/build/local-development.mdx @@ -1,6 +1,6 @@ --- title: Local Development -pcx_content_type: build +pcx_content_type: reference updated: 2024-11-27 sidebar: order: 8 diff --git a/src/content/products/audit-logs.yaml b/src/content/products/audit-logs.yaml index 45def0f70835307..808370236ecf675 100644 --- a/src/content/products/audit-logs.yaml +++ b/src/content/products/audit-logs.yaml @@ -5,3 +5,7 @@ product: group: Core platform url: /fundamentals/account/account-security/review-audit-logs/ show: false + +meta: + title: Cloudflare Audit Logs docs + author: "@cloudflare" \ No newline at end of file diff --git a/src/content/products/risk-score.yaml b/src/content/products/risk-score.yaml index 00ba51800e48bda..9000d3d88d3d321 100644 --- a/src/content/products/risk-score.yaml +++ b/src/content/products/risk-score.yaml @@ -5,3 +5,6 @@ product: group: Cloudflare One url: /cloudflare-one/insights/risk-score/ show: false + +meta: + title: Cloudflare Risk Score docs \ No newline at end of file diff --git a/src/pages/changelog/[...slug].astro b/src/pages/changelog/[...slug].astro index 787091db4a3a84b..56d282685534443 100644 --- a/src/pages/changelog/[...slug].astro +++ b/src/pages/changelog/[...slug].astro @@ -35,6 +35,8 @@ const props = { template: "splash", noindex: note.data.hidden, chatbot_deprioritize: true, + pcx_content_type: "changelog-entry", + products: note.data.products.map(a => a.id), }, headings, hideTitle: true, diff --git a/src/pages/workers-ai/models/[name].astro b/src/pages/workers-ai/models/[name].astro index f37151f8e672bd9..a833a3ae2e96308 100644 --- a/src/pages/workers-ai/models/[name].astro +++ b/src/pages/workers-ai/models/[name].astro @@ -123,6 +123,7 @@ const starlightPageProps = { frontmatter: { title: name, description, + pcx_content_type: "reference", }, headings: [ hasPlayground diff --git a/src/schemas/base.ts b/src/schemas/base.ts index d432095725bf817..a42205950fe7603 100644 --- a/src/schemas/base.ts +++ b/src/schemas/base.ts @@ -23,8 +23,8 @@ export const baseSchema = ({ image }: SchemaContext) => ), pcx_content_type: z .union([ - z.literal("api"), z.literal("changelog"), + z.literal("changelog-entry"), z.literal("configuration"), z.literal("concept"), z.literal("design-guide"), @@ -40,6 +40,7 @@ export const baseSchema = ({ image }: SchemaContext) => z.literal("reference"), z.literal("reference-architecture"), z.literal("reference-architecture-diagram"), + z.literal("release-notes"), z.literal("troubleshooting"), z.literal("tutorial"), z.literal("video"), diff --git a/worker/index.worker.test.ts b/worker/index.worker.test.ts index 866e69d52a4f1e6..89c02de4803e72a 100644 --- a/worker/index.worker.test.ts +++ b/worker/index.worker.test.ts @@ -43,21 +43,6 @@ describe("Cloudflare Docs", () => { expect(response.headers.get("Location")).toBe("/products/"); }); - it("redirects /changelog-next/ to /changelog/", async () => { - const request = new Request("http://fakehost/changelog-next/"); - const response = await SELF.fetch(request, { redirect: "manual" }); - expect(response.status).toBe(301); - expect(response.headers.get("Location")).toBe("/changelog/"); - }); - - it("redirects /changelog-next/rss.xml to /changelog/rss.xml", async () => { - const request = new Request("http://fakehost/changelog-next/rss.xml"); - const response = await SELF.fetch(request, { redirect: "manual" }); - - expect(response.status).toBe(301); - expect(response.headers.get("Location")).toBe("/changelog/rss.xml"); - }); - it("redirects /workers/index.html.md to /workers/index.md", async () => { const request = new Request("http://fakehost/workers/index.html.md"); const response = await SELF.fetch(request, { redirect: "manual" }); @@ -241,15 +226,19 @@ describe("Cloudflare Docs", () => { const html = await response.text(); const dom = parse(html); - it("product meta tags", () => { + it("meta tags", () => { const product = dom.querySelector("meta[name='pcx_product']") ?.attributes.content; const group = dom.querySelector("meta[name='pcx_content_group']") ?.attributes.content; + const content_type = dom.querySelector("meta[name='pcx_content_type']") + ?.attributes.content; + expect(product).toBe("Workers"); expect(group).toBe("Developer platform"); + expect(content_type).toBe("Overview"); }); it("index.md rel='alternate' tag", () => { @@ -305,5 +294,30 @@ describe("Cloudflare Docs", () => { ); }); }); + describe("/changelog/ entry content types", async () => { + const request = new Request( + "http://fakehost/changelog/2025-03-03-saml-oidc-fields-saml-transformations/", + ); + const response = await SELF.fetch(request); + expect(response.status).toBe(200); + + const html = await response.text(); + const dom = parse(html); + + it("correct meta tags", () => { + const product = dom.querySelector("meta[name='pcx_product']") + ?.attributes.content; + + const group = dom.querySelector("meta[name='pcx_content_group']") + ?.attributes.content; + + const content_type = dom.querySelector("meta[name='pcx_content_type']") + ?.attributes.content; + + expect(product).toBe("Access"); + expect(group).toBe("Cloudflare One"); + expect(content_type).toBe("Changelog entry"); + }); + }); }); });