Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 35 additions & 26 deletions src/components/overrides/Head.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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,
});
});
}
Expand Down Expand Up @@ -209,6 +217,7 @@ metaTags.map((attrs) => {
attrs,
});
});

---

<script src="src/scripts/footnotes.ts"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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**.
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/autorag/platform/release-note.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pcx_content_type: Release notes
pcx_content_type: release-notes
title: Release note
release_notes_file_name:
- autorag
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
type: overview
pcx_content_type: content
pcx_content_type: example
title: Connect to MySQL
hideChildren: false
sidebar:
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/logs/logpush/logpush-job/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pcx_content_type: how-tp
pcx_content_type: navigation
title: Logpush job setup
sidebar:
order: 2
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/turnstile/migration/hcaptcha.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Migrate from hCaptcha
pcx_content_type: migration
pcx_content_type: how-to
sidebar:
order: 2

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/turnstile/migration/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Migration
pcx_content_type: migration
pcx_content_type: navigation
sidebar:
order: 2
---
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/turnstile/migration/recaptcha.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Migrate from reCAPTCHA
pcx_content_type: migration
pcx_content_type: how-to
sidebar:
order: 1

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/use-cases/ai.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pcx_content_type: use_case
pcx_content_type: overview
title: Build AI Applications
head:
- tag: title
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/languages/python/examples.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pcx_content_type: content
pcx_content_type: example
title: Examples
head:
- tag: title
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/languages/python/ffi.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pcx_content_type: content
pcx_content_type: reference
title: Foreign Function Interface (FFI)
head:
- tag: title
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pcx_content_type: content
pcx_content_type: concept
title: How Python Workers Work
sidebar:
order: 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pcx_content_type: content
pcx_content_type: reference
title: FastAPI
head:
- tag: title
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pcx_content_type: content
pcx_content_type: reference
title: Langchain
head:
- tag: title
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/languages/python/stdlib.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
pcx_content_type: content
pcx_content_type: reference
title: Standard Library
sidebar:
order: 3
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workflows/build/local-development.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Local Development
pcx_content_type: build
pcx_content_type: reference
updated: 2024-11-27
sidebar:
order: 8
Expand Down
4 changes: 4 additions & 0 deletions src/content/products/audit-logs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 3 additions & 0 deletions src/content/products/risk-score.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ product:
group: Cloudflare One
url: /cloudflare-one/insights/risk-score/
show: false

meta:
title: Cloudflare Risk Score docs
2 changes: 2 additions & 0 deletions src/pages/changelog/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/pages/workers-ai/models/[name].astro
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const starlightPageProps = {
frontmatter: {
title: name,
description,
pcx_content_type: "reference",
},
headings: [
hasPlayground
Expand Down
3 changes: 2 additions & 1 deletion src/schemas/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down
46 changes: 30 additions & 16 deletions worker/index.worker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" });
Expand Down Expand Up @@ -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", () => {
Expand Down Expand Up @@ -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");
});
});
});
});
Loading