diff --git a/src/components/overrides/Head.astro b/src/components/overrides/Head.astro index 175a8e4f25d1568..cf92615d13a2faa 100644 --- a/src/components/overrides/Head.astro +++ b/src/components/overrides/Head.astro @@ -9,6 +9,7 @@ import type { CollectionEntry } from "astro:content"; const DEFAULT_TITLE_DELIMITER = "|"; const NOINDEX_PRODUCTS = ["email-security", "style-guide", "security"]; +const CHATBOT_DEPRIORITIZE_PRODUCTS = ["firewall"]; const currentSection = Astro.url.pathname.split("/")[1].replaceAll(".", ""); @@ -22,6 +23,10 @@ const shouldNoIndex = frontmatter.noindex || frontmatter.external_link; +const shouldChatbotDeprioritize = + CHATBOT_DEPRIORITIZE_PRODUCTS.includes(currentSection) || + frontmatter.chatbot_deprioritize; + if (currentSection) { const product = await getEntry("products", currentSection); @@ -83,6 +88,16 @@ if (shouldNoIndex) { }); } +if (shouldChatbotDeprioritize) { + head.push({ + tag: "meta", + attrs: { + name: "pcx_chatbot_deprioritize", + content: true, + }, + }); +} + if ( frontmatter.description && head.findIndex( diff --git a/src/schemas/base.ts b/src/schemas/base.ts index ad3a669224addb8..3b285b840fbc2e3 100644 --- a/src/schemas/base.ts +++ b/src/schemas/base.ts @@ -97,7 +97,13 @@ export const baseSchema = ({ image }: SchemaContext) => .boolean() .optional() .describe( - "If true, this property adds a `noindex` declaration to the page, which will tell internal / external search crawlers to ignore this page. Helpful for pages that are historically accurate, but no longer recommended, such as [Workers Sites](/workers/configuration/sites/).", + "If true, this property adds a `noindex` declaration to the page, which will tell internal / external search crawlers to ignore this page. Helpful for pages that are historically accurate, but no longer recommended, such as [Workers Sites](/workers/configuration/sites/). Companion to the `chatbot_deprioritize` property.", + ), + chatbot_deprioritize: z + .boolean() + .optional() + .describe( + "If true, this property will de-prioritize this page in the responses surfaced by Support AI. Helpful for pages that are historically accurate, but no longer recommended, such as [Workers Sites](/workers/configuration/sites/). Companion to the `noindex` property.", ), sidebar, hideChildren: z diff --git a/src/util/markdown.ts b/src/util/markdown.ts index 2605c2e9944b8d0..fb0c2e1ae023386 100644 --- a/src/util/markdown.ts +++ b/src/util/markdown.ts @@ -32,12 +32,18 @@ export async function htmlToMarkdown( const description = dom.querySelector("meta[name='description']")?.attributes .content; const lastUpdated = dom.querySelector(".meta time")?.attributes.datetime; + const chatbotDeprioritize = dom.querySelector( + "meta[name='pcx_chatbot_deprioritize']", + )?.attributes.content; + const tags = dom.querySelector("meta[name='pcx_tags']")?.attributes.content; const withFrontmatter = [ "---", `title: ${title}`, description ? `description: ${description}` : [], lastUpdated ? `lastUpdated: ${lastUpdated}` : [], + chatbotDeprioritize ? `chatbotDeprioritize: ${chatbotDeprioritize}` : [], + tags ? `tags: ${tags}` : [], `source_url:`, ` html: ${url.replace("index.md", "")}`, ` md: ${url}`,