diff --git a/src/content/docs/rules/examples.mdx b/src/content/docs/rules/examples.mdx
index 93a3d9b33b37ce..3f128173626afc 100644
--- a/src/content/docs/rules/examples.mdx
+++ b/src/content/docs/rules/examples.mdx
@@ -1,5 +1,4 @@
---
-
pcx_content_type: navigation
title: Examples
sidebar:
@@ -19,5 +18,5 @@ We have a separate listing for [Cache rules examples](/cache/how-to/cache-rules/
diff --git a/src/content/docs/rules/snippets/examples/ab-testing-same-url.mdx b/src/content/docs/rules/snippets/examples/ab-testing-same-url.mdx
index c6e9140e1f0128..155a8942f43411 100644
--- a/src/content/docs/rules/snippets/examples/ab-testing-same-url.mdx
+++ b/src/content/docs/rules/snippets/examples/ab-testing-same-url.mdx
@@ -1,11 +1,9 @@
---
-
summary: Set up an A/B test by controlling what response is served based on cookies.
-goal:
+tags:
- A/B testing
-operation:
- - Cookies manipulation
- - Rewrite URL
+ - Cookies
+ - URL rewrite
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/append-dates-to-cookies.mdx b/src/content/docs/rules/snippets/examples/append-dates-to-cookies.mdx
index 6ecaaeeb0970b1..3c930455366cb0 100644
--- a/src/content/docs/rules/snippets/examples/append-dates-to-cookies.mdx
+++ b/src/content/docs/rules/snippets/examples/append-dates-to-cookies.mdx
@@ -1,10 +1,8 @@
---
-
summary: Dynamically set a cookie expiration and test group.
-goal:
+tags:
- A/B testing
-operation:
- - Cookies manipulation
+ - Cookies
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/auth-with-headers.mdx b/src/content/docs/rules/snippets/examples/auth-with-headers.mdx
index 8714bf42ad4473..86de059b11588b 100644
--- a/src/content/docs/rules/snippets/examples/auth-with-headers.mdx
+++ b/src/content/docs/rules/snippets/examples/auth-with-headers.mdx
@@ -1,11 +1,9 @@
---
-
summary: Allow or deny a request based on a known pre-shared key in a header.
This is not meant to replace the [WebCrypto
API](/workers/runtime-apis/web-crypto/).
-goal:
+tags:
- Authentication
-operation:
- Request modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/bot-data-to-origin.mdx b/src/content/docs/rules/snippets/examples/bot-data-to-origin.mdx
index b8da1f5c8f7c60..003caa8f536df0 100644
--- a/src/content/docs/rules/snippets/examples/bot-data-to-origin.mdx
+++ b/src/content/docs/rules/snippets/examples/bot-data-to-origin.mdx
@@ -1,11 +1,9 @@
---
-
summary: Send [Bots](/bots/) information to your origin. Refer to [Bot
Managenent variables](/bots/reference/bot-management-variables/) for a full
list of available fields.
-goal:
- - Manage headers
-operation:
+tags:
+ - Headers
- Request modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/bots-to-honeypot.mdx b/src/content/docs/rules/snippets/examples/bots-to-honeypot.mdx
index 975b5d6b1e1a03..7b3d413c8cb5a8 100644
--- a/src/content/docs/rules/snippets/examples/bots-to-honeypot.mdx
+++ b/src/content/docs/rules/snippets/examples/bots-to-honeypot.mdx
@@ -1,12 +1,9 @@
---
-
summary: Use the [bot score
field](/workers/runtime-apis/request/#incomingrequestcfproperties) to send
bots to a honeypot.
-goal:
- - Routing
-operation:
- - Redirect
+tags:
+ - Redirects
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/bulk-redirect-map.mdx b/src/content/docs/rules/snippets/examples/bulk-redirect-map.mdx
index 7e8b1b7f91a4b8..1a11aa49a3d3be 100644
--- a/src/content/docs/rules/snippets/examples/bulk-redirect-map.mdx
+++ b/src/content/docs/rules/snippets/examples/bulk-redirect-map.mdx
@@ -1,11 +1,8 @@
---
-
summary: Redirect requests to certain URLs based on a mapped object to the
request's URL.
-goal:
- - Routing
-operation:
- - Redirect
+tags:
+ - Redirects
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/country-code-redirect.mdx b/src/content/docs/rules/snippets/examples/country-code-redirect.mdx
index 758eea035b6628..1a3de77de39a3d 100644
--- a/src/content/docs/rules/snippets/examples/country-code-redirect.mdx
+++ b/src/content/docs/rules/snippets/examples/country-code-redirect.mdx
@@ -1,10 +1,8 @@
---
-
summary: Redirect a response based on the country code in the header of a visitor.
-goal:
+tags:
- Localization
-operation:
- - Redirect
+ - Redirects
products:
- Snippets
preview:
diff --git a/src/content/docs/rules/snippets/examples/custom-cache.mdx b/src/content/docs/rules/snippets/examples/custom-cache.mdx
index db9326ba8afd17..96efb294a9d407 100644
--- a/src/content/docs/rules/snippets/examples/custom-cache.mdx
+++ b/src/content/docs/rules/snippets/examples/custom-cache.mdx
@@ -1,10 +1,7 @@
---
-
summary: Control cache programmatically. Use this template to optimize performance and implement custom caching strategies.
-goal:
- - Other
-operation:
- - Cache
+tags:
+ - Caching
products:
- Snippets
pcx_content_type: example
@@ -22,49 +19,54 @@ const USE_QUERY_STRING = true; // Include query string in the cache key
const INCLUDE_HEADERS = ["User-Agent"]; // Headers to include in the cache key
export default {
- async fetch(request, env, ctx) {
- // Generate a custom cache key based on user preferences
- const cacheKey = createCacheKey(request);
- console.log(`Retrieving cache for: ${cacheKey.url}.`)
-
- // Access the default Cache API
- const cache = caches.default;
-
- // Attempt to retrieve the cached response
- let response = await cache.match(cacheKey);
-
- if (!response) {
- // Cache miss: Fetch the asset from the origin
- console.log(`Cache miss for: ${cacheKey.url}. Fetching from origin...`);
- response = await fetch(request);
-
- // Wrap the origin response for caching
- response = new Response(response.body, response);
-
- // Set Cache-Control headers to define the TTL
- response.headers.set("Cache-Control", `s-maxage=${CACHE_DURATION_SECONDS}`);
- response.headers.set("x-snippets-cache", "stored");
-
- // Store the response in the cache
- await cache.put(cacheKey, response.clone());
- } else {
- // Cache hit: Return the cached response
- console.log(`Cache hit for: ${cacheKey.url}.`);
- response = new Response(response.body, response);
- response.headers.set("x-snippets-cache", "hit");
-
- // Optionally check if the cache should expire based on age
- const ageHeader = response.headers.get("Age");
- if (ageHeader && parseInt(ageHeader, 10) > CACHE_DURATION_SECONDS) {
- console.log(`Cache expired for: ${cacheKey.url}. Deleting cached response...`);
- await cache.delete(cacheKey);
- response.headers.set("x-snippets-cache", "deleted");
- }
- }
-
- // Return the response to the client
- return response;
- },
+ async fetch(request, env, ctx) {
+ // Generate a custom cache key based on user preferences
+ const cacheKey = createCacheKey(request);
+ console.log(`Retrieving cache for: ${cacheKey.url}.`);
+
+ // Access the default Cache API
+ const cache = caches.default;
+
+ // Attempt to retrieve the cached response
+ let response = await cache.match(cacheKey);
+
+ if (!response) {
+ // Cache miss: Fetch the asset from the origin
+ console.log(`Cache miss for: ${cacheKey.url}. Fetching from origin...`);
+ response = await fetch(request);
+
+ // Wrap the origin response for caching
+ response = new Response(response.body, response);
+
+ // Set Cache-Control headers to define the TTL
+ response.headers.set(
+ "Cache-Control",
+ `s-maxage=${CACHE_DURATION_SECONDS}`,
+ );
+ response.headers.set("x-snippets-cache", "stored");
+
+ // Store the response in the cache
+ await cache.put(cacheKey, response.clone());
+ } else {
+ // Cache hit: Return the cached response
+ console.log(`Cache hit for: ${cacheKey.url}.`);
+ response = new Response(response.body, response);
+ response.headers.set("x-snippets-cache", "hit");
+
+ // Optionally check if the cache should expire based on age
+ const ageHeader = response.headers.get("Age");
+ if (ageHeader && parseInt(ageHeader, 10) > CACHE_DURATION_SECONDS) {
+ console.log(
+ `Cache expired for: ${cacheKey.url}. Deleting cached response...`,
+ );
+ await cache.delete(cacheKey);
+ response.headers.set("x-snippets-cache", "deleted");
+ }
+ }
+
+ // Return the response to the client
+ return response;
+ },
};
/**
@@ -73,28 +75,30 @@ export default {
* @returns {Request} - A valid cache key based on the URL
*/
function createCacheKey(request) {
- const url = new URL(request.url); // Use the request's base URL
- const cacheKey = new URL(url.origin); // Start with the origin (scheme + hostname)
-
- // Optionally include the path
- if (USE_PATH) {
- cacheKey.pathname = url.pathname;
- }
-
- // Optionally include the query string
- if (USE_QUERY_STRING) {
- cacheKey.search = url.search;
- }
-
- // Optionally include specific headers
- if (INCLUDE_HEADERS.length > 0) {
- const headerParts = INCLUDE_HEADERS.map(header => `${header}=${request.headers.get(header) || ""}`).join("&");
- cacheKey.searchParams.append("headers", headerParts);
- }
-
- // Return the constructed URL as the cache key
- return new Request(cacheKey.toString(), {
- method: "GET"
- });
+ const url = new URL(request.url); // Use the request's base URL
+ const cacheKey = new URL(url.origin); // Start with the origin (scheme + hostname)
+
+ // Optionally include the path
+ if (USE_PATH) {
+ cacheKey.pathname = url.pathname;
+ }
+
+ // Optionally include the query string
+ if (USE_QUERY_STRING) {
+ cacheKey.search = url.search;
+ }
+
+ // Optionally include specific headers
+ if (INCLUDE_HEADERS.length > 0) {
+ const headerParts = INCLUDE_HEADERS.map(
+ (header) => `${header}=${request.headers.get(header) || ""}`,
+ ).join("&");
+ cacheKey.searchParams.append("headers", headerParts);
+ }
+
+ // Return the constructed URL as the cache key
+ return new Request(cacheKey.toString(), {
+ method: "GET",
+ });
}
```
diff --git a/src/content/docs/rules/snippets/examples/debugging-logs.mdx b/src/content/docs/rules/snippets/examples/debugging-logs.mdx
index 775e4e3025edd4..d02fdfc623da67 100644
--- a/src/content/docs/rules/snippets/examples/debugging-logs.mdx
+++ b/src/content/docs/rules/snippets/examples/debugging-logs.mdx
@@ -1,9 +1,7 @@
---
-
summary: Send debugging information in an errored response to a logging service.
-goal:
+tags:
- Logging
-operation:
- Response modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/define-cors-headers.mdx b/src/content/docs/rules/snippets/examples/define-cors-headers.mdx
index 96b7a8d9d930f2..37c28457ee3315 100644
--- a/src/content/docs/rules/snippets/examples/define-cors-headers.mdx
+++ b/src/content/docs/rules/snippets/examples/define-cors-headers.mdx
@@ -1,11 +1,9 @@
---
-
summary: Adjust [Cross-Origin Resource Sharing
(CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) headers and
handle preflight requests.
-goal:
- - Manage headers
-operation:
+tags:
+ - Headers
- Request modification
- Response modification
products:
diff --git a/src/content/docs/rules/snippets/examples/follow-redirects.mdx b/src/content/docs/rules/snippets/examples/follow-redirects.mdx
index f6121c90429d36..445af1754b78f0 100644
--- a/src/content/docs/rules/snippets/examples/follow-redirects.mdx
+++ b/src/content/docs/rules/snippets/examples/follow-redirects.mdx
@@ -1,10 +1,7 @@
---
-
summary: Modify the fetch request to follow redirects from the origin, ensuring the client receives the final response.
-goal:
- - Routing
-operation:
- - Redirect
+tags:
+ - Redirects
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/hex-timestamp.mdx b/src/content/docs/rules/snippets/examples/hex-timestamp.mdx
index 5211ef559ee3c1..c04e1624b03d46 100644
--- a/src/content/docs/rules/snippets/examples/hex-timestamp.mdx
+++ b/src/content/docs/rules/snippets/examples/hex-timestamp.mdx
@@ -1,9 +1,7 @@
---
-
summary: Add a custom header to requests sent to the origin server with the current timestamp in hexadecimal format.
-goal:
- - Manage headers
-operation:
+tags:
+ - Headers
- Request modification
products:
- Snippets
@@ -14,26 +12,26 @@ description: Add a custom header to requests sent to the origin server with the
```js
export default {
- async fetch(request) {
- // Get the current timestamp
- const timestamp = Date.now();
+ async fetch(request) {
+ // Get the current timestamp
+ const timestamp = Date.now();
- // Convert the timestamp to hexadecimal format
- const hexTimestamp = timestamp.toString(16);
+ // Convert the timestamp to hexadecimal format
+ const hexTimestamp = timestamp.toString(16);
- // Clone the request and add the custom header
- const modifiedRequest = new Request(request, {
- headers: new Headers(request.headers)
- });
- modifiedRequest.headers.set("X-Hex-Timestamp", hexTimestamp);
+ // Clone the request and add the custom header
+ const modifiedRequest = new Request(request, {
+ headers: new Headers(request.headers),
+ });
+ modifiedRequest.headers.set("X-Hex-Timestamp", hexTimestamp);
- // Log the custom header for debugging
- console.log(`X-Hex-Timestamp: ${hexTimestamp}`);
+ // Log the custom header for debugging
+ console.log(`X-Hex-Timestamp: ${hexTimestamp}`);
- // Pass the modified request to the origin
- const response = await fetch(modifiedRequest);
+ // Pass the modified request to the origin
+ const response = await fetch(modifiedRequest);
- return response;
- },
+ return response;
+ },
};
-```
\ No newline at end of file
+```
diff --git a/src/content/docs/rules/snippets/examples/index.mdx b/src/content/docs/rules/snippets/examples/index.mdx
index 2b7db2407dd09a..84b3412a120057 100644
--- a/src/content/docs/rules/snippets/examples/index.mdx
+++ b/src/content/docs/rules/snippets/examples/index.mdx
@@ -1,5 +1,4 @@
---
-
hideChildren: true
pcx_content_type: navigation
title: Examples
@@ -15,6 +14,6 @@ Refer to [How it works](/rules/snippets/how-it-works/) and [Create a snippet in
diff --git a/src/content/docs/rules/snippets/examples/jwt-validation.mdx b/src/content/docs/rules/snippets/examples/jwt-validation.mdx
index 7d52cc7f7893ed..b2f24d71051aac 100644
--- a/src/content/docs/rules/snippets/examples/jwt-validation.mdx
+++ b/src/content/docs/rules/snippets/examples/jwt-validation.mdx
@@ -1,10 +1,8 @@
---
-
summary: Extract the JWT token from a header, decode it, and implement
validation checks to verify it.
-goal:
+tags:
- Authentication
-operation:
- Request modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/maintenance.mdx b/src/content/docs/rules/snippets/examples/maintenance.mdx
index 013a4c0aae8137..097250156c8c80 100644
--- a/src/content/docs/rules/snippets/examples/maintenance.mdx
+++ b/src/content/docs/rules/snippets/examples/maintenance.mdx
@@ -1,10 +1,7 @@
---
-
summary: Serve a custom maintenance page. Ideal for downtime notifications, planned maintenance, or emergency messages.
-goal:
- - Routing
-operation:
- - Redirect
+tags:
+ - Redirects
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/override-set-cookies-value.mdx b/src/content/docs/rules/snippets/examples/override-set-cookies-value.mdx
index b3b9004936c9cb..3a8b4958ff411e 100644
--- a/src/content/docs/rules/snippets/examples/override-set-cookies-value.mdx
+++ b/src/content/docs/rules/snippets/examples/override-set-cookies-value.mdx
@@ -1,11 +1,9 @@
---
-
summary: Get a specific `Set-Cookie` header and update it with a certain value.
-goal:
- - Manage headers
-operation:
+tags:
+ - Headers
+ - Cookies
- Response modification
- - Cookies manipulation
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/redirect-forbidden-status.mdx b/src/content/docs/rules/snippets/examples/redirect-forbidden-status.mdx
index 2a65ed2a34d8cb..34280fa18811b7 100644
--- a/src/content/docs/rules/snippets/examples/redirect-forbidden-status.mdx
+++ b/src/content/docs/rules/snippets/examples/redirect-forbidden-status.mdx
@@ -1,11 +1,8 @@
---
-
summary: If origin responded with `403 Forbidden` error code, redirect to
different page.
-goal:
- - Routing
-operation:
- - Redirect
+tags:
+ - Redirects
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/redirect-replaced-domain.mdx b/src/content/docs/rules/snippets/examples/redirect-replaced-domain.mdx
index c5e7f1e4ea399b..53bf112aaf690c 100644
--- a/src/content/docs/rules/snippets/examples/redirect-replaced-domain.mdx
+++ b/src/content/docs/rules/snippets/examples/redirect-replaced-domain.mdx
@@ -1,10 +1,7 @@
---
-
summary: Redirect all requests from one domain to another domain.
-goal:
- - Routing
-operation:
- - Redirect
+tags:
+ - Redirects
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/remove-fields-api-response.mdx b/src/content/docs/rules/snippets/examples/remove-fields-api-response.mdx
index df6a97e4dd4f3d..90ee8eebf03383 100644
--- a/src/content/docs/rules/snippets/examples/remove-fields-api-response.mdx
+++ b/src/content/docs/rules/snippets/examples/remove-fields-api-response.mdx
@@ -1,10 +1,7 @@
---
-
summary: If origin responds with `JSON`, parse the response and delete fields to
return a modified response.
-goal:
- - Other
-operation:
+tags:
- Response modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/remove-query-strings.mdx b/src/content/docs/rules/snippets/examples/remove-query-strings.mdx
index a536d072a4519a..32bbb01f780765 100644
--- a/src/content/docs/rules/snippets/examples/remove-query-strings.mdx
+++ b/src/content/docs/rules/snippets/examples/remove-query-strings.mdx
@@ -1,9 +1,6 @@
---
-
summary: Remove certain query strings from a request before passing to the origin.
-goal:
- - Other
-operation:
+tags:
- Request modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/remove-response-headers.mdx b/src/content/docs/rules/snippets/examples/remove-response-headers.mdx
index 6d896104117bac..7ca3d571dfbdd9 100644
--- a/src/content/docs/rules/snippets/examples/remove-response-headers.mdx
+++ b/src/content/docs/rules/snippets/examples/remove-response-headers.mdx
@@ -1,9 +1,6 @@
---
-
summary: Remove from response all headers that start with a certain name.
-goal:
- - Manage headers
-operation:
+tags:
- Response modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/return-incoming-request-properties.mdx b/src/content/docs/rules/snippets/examples/return-incoming-request-properties.mdx
index d047637cc4f89f..6113d00a69921e 100644
--- a/src/content/docs/rules/snippets/examples/return-incoming-request-properties.mdx
+++ b/src/content/docs/rules/snippets/examples/return-incoming-request-properties.mdx
@@ -1,10 +1,8 @@
---
-
summary: Respond with information about the incoming request provided by
Cloudflare’s global network.
-goal:
+tags:
- Logging
-operation:
- Response modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/rewrite-site-links.mdx b/src/content/docs/rules/snippets/examples/rewrite-site-links.mdx
index 589d728a5dd428..1ac12fc17aaeef 100644
--- a/src/content/docs/rules/snippets/examples/rewrite-site-links.mdx
+++ b/src/content/docs/rules/snippets/examples/rewrite-site-links.mdx
@@ -1,9 +1,6 @@
---
-
summary: Dynamically rewrite links in HTML responses.
-goal:
- - Other
-operation:
+tags:
- Response modification
products:
- Snippets
@@ -14,47 +11,47 @@ description: Dynamically rewrite links in HTML responses. This is useful for sit
```js
export default {
- async fetch(request) {
- // Define the old hostname here.
- const OLD_URL = "oldsite.com";
- // Then add your new hostname that should replace the old one.
- const NEW_URL = "newsite.com";
+ async fetch(request) {
+ // Define the old hostname here.
+ const OLD_URL = "oldsite.com";
+ // Then add your new hostname that should replace the old one.
+ const NEW_URL = "newsite.com";
- class AttributeRewriter {
- constructor(attributeName) {
- this.attributeName = attributeName;
- }
- element(element) {
- const attribute = element.getAttribute(this.attributeName);
- if (attribute) {
- element.setAttribute(
- this.attributeName,
- attribute.replace(OLD_URL, NEW_URL),
- );
- }
- }
- }
+ class AttributeRewriter {
+ constructor(attributeName) {
+ this.attributeName = attributeName;
+ }
+ element(element) {
+ const attribute = element.getAttribute(this.attributeName);
+ if (attribute) {
+ element.setAttribute(
+ this.attributeName,
+ attribute.replace(OLD_URL, NEW_URL),
+ );
+ }
+ }
+ }
- const rewriter = new HTMLRewriter()
- .on("a", new AttributeRewriter("href"))
- .on("img", new AttributeRewriter("src"));
+ const rewriter = new HTMLRewriter()
+ .on("a", new AttributeRewriter("href"))
+ .on("img", new AttributeRewriter("src"));
- const res = await fetch(request);
- if (!res.headers.has("Content-Type")) {
- return res;
- }
- const contentType = res.headers.get("Content-Type");
- if (typeof contentType !== "string") {
- return res;
- }
+ const res = await fetch(request);
+ if (!res.headers.has("Content-Type")) {
+ return res;
+ }
+ const contentType = res.headers.get("Content-Type");
+ if (typeof contentType !== "string") {
+ return res;
+ }
- // If the response is HTML, it can be transformed with
- // HTMLRewriter -- otherwise, it should pass through
- if (contentType.startsWith("text/html")) {
- return rewriter.transform(res);
- } else {
- return res;
- }
- },
+ // If the response is HTML, it can be transformed with
+ // HTMLRewriter -- otherwise, it should pass through
+ if (contentType.startsWith("text/html")) {
+ return rewriter.transform(res);
+ } else {
+ return res;
+ }
+ },
};
```
diff --git a/src/content/docs/rules/snippets/examples/route-and-rewrite.mdx b/src/content/docs/rules/snippets/examples/route-and-rewrite.mdx
index 19241a33359b51..ec4750ce9248d0 100644
--- a/src/content/docs/rules/snippets/examples/route-and-rewrite.mdx
+++ b/src/content/docs/rules/snippets/examples/route-and-rewrite.mdx
@@ -1,10 +1,7 @@
---
-
summary: Reroute a request to a different origin and modify the URL path.
-goal:
- - Routing
-operation:
- - Modify URL
+tags:
+ - URL rewrite
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/security-headers.mdx b/src/content/docs/rules/snippets/examples/security-headers.mdx
index 19550593f1ac72..c172871a5f0b41 100644
--- a/src/content/docs/rules/snippets/examples/security-headers.mdx
+++ b/src/content/docs/rules/snippets/examples/security-headers.mdx
@@ -1,10 +1,8 @@
---
-
summary: Set common security headers such as X-XSS-Protection, X-Frame-Options,
and X-Content-Type-Options.
-goal:
- - Manage headers
-operation:
+tags:
+ - Headers
- Response modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/send-timestamp-to-origin.mdx b/src/content/docs/rules/snippets/examples/send-timestamp-to-origin.mdx
index 344644a2a042c3..41b12f808b0bee 100644
--- a/src/content/docs/rules/snippets/examples/send-timestamp-to-origin.mdx
+++ b/src/content/docs/rules/snippets/examples/send-timestamp-to-origin.mdx
@@ -1,10 +1,8 @@
---
-
summary: Convert timestamp to hexadecimal format and send it as a custom header
to the origin.
-goal:
- - Manage headers
-operation:
+tags:
+ - Headers
- Request modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/serve-different-origin.mdx b/src/content/docs/rules/snippets/examples/serve-different-origin.mdx
index ac152d62004c74..d7173d4a9ce303 100644
--- a/src/content/docs/rules/snippets/examples/serve-different-origin.mdx
+++ b/src/content/docs/rules/snippets/examples/serve-different-origin.mdx
@@ -1,11 +1,8 @@
---
-
summary: If response to the original request is not `200 OK` or a redirect, send
to another origin.
-goal:
- - Routing
-operation:
- - Redirect
+tags:
+ - Redirects
products:
- Snippets
pcx_content_type: example
diff --git a/src/content/docs/rules/snippets/examples/signing-requests.mdx b/src/content/docs/rules/snippets/examples/signing-requests.mdx
index 57c56edd10f40c..07d5cea0425986 100644
--- a/src/content/docs/rules/snippets/examples/signing-requests.mdx
+++ b/src/content/docs/rules/snippets/examples/signing-requests.mdx
@@ -1,9 +1,7 @@
---
-
summary: Verify a signed request using the HMAC and SHA-256 algorithms or return a 403.
-goal:
+tags:
- Authentication
-operation:
- Request modification
products:
- Snippets
diff --git a/src/content/docs/rules/snippets/examples/slow-suspicious-requests.mdx b/src/content/docs/rules/snippets/examples/slow-suspicious-requests.mdx
index f15617ec43ebfe..0f1935a8627010 100644
--- a/src/content/docs/rules/snippets/examples/slow-suspicious-requests.mdx
+++ b/src/content/docs/rules/snippets/examples/slow-suspicious-requests.mdx
@@ -1,10 +1,7 @@
---
-
summary: Define a delay to be used when incoming requests match a rule you
consider suspicious based on the bot score.
-goal:
- - Other
-operation:
+tags:
- Request modification
products:
- Snippets
diff --git a/src/content/docs/rules/transform/examples/add-request-header-bot-score.mdx b/src/content/docs/rules/transform/examples/add-request-header-bot-score.mdx
index c7705c72dcfa8f..c6f071ec2008f4 100644
--- a/src/content/docs/rules/transform/examples/add-request-header-bot-score.mdx
+++ b/src/content/docs/rules/transform/examples/add-request-header-bot-score.mdx
@@ -3,7 +3,7 @@ pcx_content_type: example
summary: Create a request header transform rule to add a `X-Bot-Score` HTTP header to the request with the current bot score.
products:
- Transform Rules
-operation:
+tags:
- Request modification
title: Add a request header with the current bot score
description: Create a request header transform rule to add a `X-Bot-Score` HTTP header to the request with the current bot score.
diff --git a/src/content/docs/rules/transform/examples/add-request-header-static-value.mdx b/src/content/docs/rules/transform/examples/add-request-header-static-value.mdx
index 2711616028d6ef..7900b252bc9e7a 100644
--- a/src/content/docs/rules/transform/examples/add-request-header-static-value.mdx
+++ b/src/content/docs/rules/transform/examples/add-request-header-static-value.mdx
@@ -5,7 +5,7 @@ summary:
(`Cloudflare`).
products:
- Transform Rules
-operation:
+tags:
- Request modification
title: Add request header with a static value
description:
diff --git a/src/content/docs/rules/transform/examples/add-request-header-subrequest-other-zone.mdx b/src/content/docs/rules/transform/examples/add-request-header-subrequest-other-zone.mdx
index 31aabf9a0af82f..1b6320a1f4acf4 100644
--- a/src/content/docs/rules/transform/examples/add-request-header-subrequest-other-zone.mdx
+++ b/src/content/docs/rules/transform/examples/add-request-header-subrequest-other-zone.mdx
@@ -3,7 +3,7 @@ pcx_content_type: example
summary: Create a request header transform rule to add an HTTP header when the Workers subrequest comes from a different zone.
products:
- Transform Rules
-operation:
+tags:
- Request modification
title: Add a request header for subrequests from other zones
description: Create a request header transform rule to add an HTTP header when the Workers subrequest comes from a different zone.
diff --git a/src/content/docs/rules/transform/examples/add-response-header-static-value.mdx b/src/content/docs/rules/transform/examples/add-response-header-static-value.mdx
index 82523500ac6dad..691aff86becce3 100644
--- a/src/content/docs/rules/transform/examples/add-response-header-static-value.mdx
+++ b/src/content/docs/rules/transform/examples/add-response-header-static-value.mdx
@@ -5,7 +5,7 @@ summary:
(`cookiename=value`).
products:
- Transform Rules
-operation:
+tags:
- Response modification
title: Add a response header with a static value
description:
diff --git a/src/content/docs/rules/transform/examples/index.mdx b/src/content/docs/rules/transform/examples/index.mdx
index 0cb2a9a6bb5635..e7ad88b2dcbcb8 100644
--- a/src/content/docs/rules/transform/examples/index.mdx
+++ b/src/content/docs/rules/transform/examples/index.mdx
@@ -1,5 +1,4 @@
---
-
pcx_content_type: navigation
title: Examples
sidebar:
@@ -8,4 +7,8 @@ sidebar:
import { ResourcesBySelector } from "~/components";
-
+
diff --git a/src/content/docs/rules/transform/examples/normalize-encoded-slash.mdx b/src/content/docs/rules/transform/examples/normalize-encoded-slash.mdx
index bb18efef8ea0fc..fa389bc217881a 100644
--- a/src/content/docs/rules/transform/examples/normalize-encoded-slash.mdx
+++ b/src/content/docs/rules/transform/examples/normalize-encoded-slash.mdx
@@ -3,8 +3,8 @@ pcx_content_type: example
summary: Create a URL rewrite rule (part of Transform Rules) to normalize encoded forward slashes (`%2F`) in the request path to standard slashes (`/`).
products:
- Transform Rules
-operation:
- - Rewrite URL
+tags:
+ - URL rewrite
title: Normalize encoded slashes in URL path
description: Create a URL rewrite rule (part of Transform Rules) to normalize encoded forward slashes (`%2F`) in the request path to standard slashes (`/`).
---
diff --git a/src/content/docs/rules/transform/examples/remove-request-header.mdx b/src/content/docs/rules/transform/examples/remove-request-header.mdx
index 1018fea175eea0..eb85a295dd4734 100644
--- a/src/content/docs/rules/transform/examples/remove-request-header.mdx
+++ b/src/content/docs/rules/transform/examples/remove-request-header.mdx
@@ -3,7 +3,7 @@ pcx_content_type: example
summary: Create a request header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the request.
products:
- Transform Rules
-operation:
+tags:
- Request modification
title: Remove a request header
description: Create a request header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the request.
diff --git a/src/content/docs/rules/transform/examples/remove-response-header.mdx b/src/content/docs/rules/transform/examples/remove-response-header.mdx
index d4ba427cd88041..0dcf87d3d03a51 100644
--- a/src/content/docs/rules/transform/examples/remove-response-header.mdx
+++ b/src/content/docs/rules/transform/examples/remove-response-header.mdx
@@ -3,7 +3,7 @@ pcx_content_type: example
summary: Create a response header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the response.
products:
- Transform Rules
-operation:
+tags:
- Response modification
title: Remove a response header
description: Create a response header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the response.
diff --git a/src/content/docs/rules/transform/examples/rewrite-archive-urls-new-format.mdx b/src/content/docs/rules/transform/examples/rewrite-archive-urls-new-format.mdx
index 0ce7c7c678d149..9b5d4cc896da5d 100644
--- a/src/content/docs/rules/transform/examples/rewrite-archive-urls-new-format.mdx
+++ b/src/content/docs/rules/transform/examples/rewrite-archive-urls-new-format.mdx
@@ -5,8 +5,8 @@ summary: Create a transform rule to rewrite the URL format
`/posts////`.
products:
- Transform Rules
-operation:
- - Rewrite URL
+tags:
+ - URL rewrite
title: Rewrite blog archive URLs
description: Create a transform rule to rewrite the URL format
`/posts/---` to the new format
diff --git a/src/content/docs/rules/transform/examples/rewrite-moved-section.mdx b/src/content/docs/rules/transform/examples/rewrite-moved-section.mdx
index 542ab03d8e2c5c..546014948b3a1f 100644
--- a/src/content/docs/rules/transform/examples/rewrite-moved-section.mdx
+++ b/src/content/docs/rules/transform/examples/rewrite-moved-section.mdx
@@ -4,8 +4,8 @@ summary: Create a URL rewrite rule (part of Transform Rules) to rewrite
everything under `/blog/` to `/marketing/`.
products:
- Transform Rules
-operation:
- - Rewrite URL
+tags:
+ - URL rewrite
title: Rewrite path of moved section of a website
description: Create a URL rewrite rule (part of Transform Rules) to rewrite
everything under `/blog/` to `/marketing/`.
diff --git a/src/content/docs/rules/transform/examples/rewrite-path-archived-posts.mdx b/src/content/docs/rules/transform/examples/rewrite-path-archived-posts.mdx
index fa337fac8083e7..6d732e17d93714 100644
--- a/src/content/docs/rules/transform/examples/rewrite-path-archived-posts.mdx
+++ b/src/content/docs/rules/transform/examples/rewrite-path-archived-posts.mdx
@@ -4,8 +4,8 @@ summary: Create a URL rewrite rule (part of Transform Rules) to rewrite any
requests for `/news/2012/...` URI paths to `/archive/news/2012/...`.
products:
- Transform Rules
-operation:
- - Rewrite URL
+tags:
+ - URL rewrite
title: Rewrite path of archived blog posts
description: Create a URL rewrite rule (part of Transform Rules) to rewrite any
requests for `/news/2012/...` URI paths to `/archive/news/2012/...`.
diff --git a/src/content/docs/rules/transform/examples/rewrite-path-object-storage.mdx b/src/content/docs/rules/transform/examples/rewrite-path-object-storage.mdx
index 906c81f29624be..0abf811b829e67 100644
--- a/src/content/docs/rules/transform/examples/rewrite-path-object-storage.mdx
+++ b/src/content/docs/rules/transform/examples/rewrite-path-object-storage.mdx
@@ -4,8 +4,8 @@ summary: Create a URL rewrite rule (part of Transform Rules) to remove
`/files/` from URI paths before routing request to your object storage bucket.
products:
- Transform Rules
-operation:
- - Rewrite URL
+tags:
+ - URL rewrite
title: Rewrite path for object storage bucket
description: Create a URL rewrite rule (part of Transform Rules) to rewrite any
requests for `/files/...` URI paths to `/...`.
diff --git a/src/content/docs/rules/transform/examples/rewrite-several-url-different-url.mdx b/src/content/docs/rules/transform/examples/rewrite-several-url-different-url.mdx
index 9bf5e59df6e07c..e837c22c9ac66a 100644
--- a/src/content/docs/rules/transform/examples/rewrite-several-url-different-url.mdx
+++ b/src/content/docs/rules/transform/examples/rewrite-several-url-different-url.mdx
@@ -4,8 +4,8 @@ summary: Create a URL rewrite rule (part of Transform Rules) to rewrite any
requests for `/images///` to `/img/`.
products:
- Transform Rules
-operation:
- - Rewrite URL
+tags:
+ - URL rewrite
title: Rewrite image paths with several URL segments
description: Create a URL rewrite rule (part of Transform Rules) to rewrite any
requests for `/images///` to `/img/`.
diff --git a/src/content/docs/rules/transform/examples/rewrite-url-string-visitors.mdx b/src/content/docs/rules/transform/examples/rewrite-url-string-visitors.mdx
index ae418a6c5ed5b0..2bfaeeba929e62 100644
--- a/src/content/docs/rules/transform/examples/rewrite-url-string-visitors.mdx
+++ b/src/content/docs/rules/transform/examples/rewrite-url-string-visitors.mdx
@@ -4,8 +4,8 @@ summary: Create a transform rule to rewrite the request path from `/blog` to
`/blog?sort-by=date`.
products:
- Transform Rules
-operation:
- - Rewrite URL
+tags:
+ - URL rewrite
title: Rewrite URL query string
description: Create a transform rule to rewrite the request path from `/blog` to
`/blog?sort-by=date`.
diff --git a/src/content/docs/rules/transform/examples/rewrite-welcome-for-countries.mdx b/src/content/docs/rules/transform/examples/rewrite-welcome-for-countries.mdx
index 01e16d45bac3b9..d4ca9a4f8f324b 100644
--- a/src/content/docs/rules/transform/examples/rewrite-welcome-for-countries.mdx
+++ b/src/content/docs/rules/transform/examples/rewrite-welcome-for-countries.mdx
@@ -4,8 +4,8 @@ summary: Create two URL rewrite rules (part of Transform Rules) to rewrite the
path of the welcome page for visitors in specific countries.
products:
- Transform Rules
-operation:
- - Rewrite URL
+tags:
+ - URL rewrite
title: Rewrite page path for visitors in specific countries
description: Create two URL rewrite rules (part of Transform Rules) to rewrite
the path of the welcome page for visitors in specific countries.
diff --git a/src/content/docs/rules/transform/examples/set-response-header-bot-score.mdx b/src/content/docs/rules/transform/examples/set-response-header-bot-score.mdx
index d9224c55fb83a6..21822844adc91e 100644
--- a/src/content/docs/rules/transform/examples/set-response-header-bot-score.mdx
+++ b/src/content/docs/rules/transform/examples/set-response-header-bot-score.mdx
@@ -4,7 +4,7 @@ summary: Create a response header transform rule (part of Transform Rules) to
set an `X-Bot-Score` HTTP header in the response with the current bot score.
products:
- Transform Rules
-operation:
+tags:
- Response modification
title: Set a response header with the current bot score
description: Create a response header transform rule (part of Transform Rules)
diff --git a/src/content/docs/rules/transform/examples/set-response-header-static-value.mdx b/src/content/docs/rules/transform/examples/set-response-header-static-value.mdx
index c76a4834c13df2..7e774d30a56f9a 100644
--- a/src/content/docs/rules/transform/examples/set-response-header-static-value.mdx
+++ b/src/content/docs/rules/transform/examples/set-response-header-static-value.mdx
@@ -4,7 +4,7 @@ summary: Create a response header transform rule (part of Transform Rules) to
set an `X-Bot-Score` HTTP header in the response to a static value (`Cloudflare`).
products:
- Transform Rules
-operation:
+tags:
- Response modification
title: Set response header with a static value
description:
diff --git a/src/schemas/base.ts b/src/schemas/base.ts
index 0da9f63ed8e5e5..6655bce2e1e0f4 100644
--- a/src/schemas/base.ts
+++ b/src/schemas/base.ts
@@ -99,8 +99,6 @@ export const baseSchema = ({ image }: SchemaContext) =>
.string()
.optional()
.describe("Renders a summary description directly below the page title."),
- goal: z.string().array().optional(),
- operation: z.string().array().optional(),
noindex: z
.boolean()
.optional()