Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
15 changes: 15 additions & 0 deletions src/components/overrides/Head.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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(".", "");
Expand All @@ -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);
Expand Down Expand Up @@ -83,6 +88,16 @@ if (shouldNoIndex) {
});
}
if (shouldChatbotDeprioritize) {
head.push({
tag: "meta",
attrs: {
name: "pcx_chatbot_deprioritize",
content: true,
},
});
}
if (
frontmatter.description &&
head.findIndex(
Expand Down
8 changes: 7 additions & 1 deletion src/schemas/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/util/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ 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 withFrontmatter = [
"---",
`title: ${title}`,
description ? `description: ${description}` : [],
lastUpdated ? `lastUpdated: ${lastUpdated}` : [],
chatbotDeprioritize ? `chatbotDeprioritize: ${chatbotDeprioritize}` : [],
`source_url:`,
` html: ${url.replace("index.md", "")}`,
` md: ${url}`,
Expand Down
Loading