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
6 changes: 0 additions & 6 deletions src/content/docs/workers/llms.txt.md

This file was deleted.

6 changes: 0 additions & 6 deletions src/content/docs/workers/prompt.md

This file was deleted.

30 changes: 29 additions & 1 deletion src/util/sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AstroGlobal } from "astro";
import type { Props } from "@astrojs/starlight/props";

import { getEntry } from "astro:content";
import { getEntry, getCollection } from "astro:content";
import { rehypeExternalLinksOptions } from "~/plugins/rehype/external-links";

type Link = Extract<Props["sidebar"][0], { type: "link" }> & { order?: number };
Expand All @@ -12,6 +12,7 @@ type Group = Extract<Props["sidebar"][0], { type: "group" }> & {
export type SidebarEntry = Link | Group;
type Badge = Link["badge"];

const products = await getCollection("products");
const sidebars = new Map<string, Group>();

export async function getSidebar(context: AstroGlobal<Props>) {
Expand Down Expand Up @@ -88,6 +89,33 @@ export async function generateSidebar(group: Group) {
group.entries[0].label = "Overview";
}

const product = products.find((p) => p.id === group.label);
if (product && product.data.product.group === "Developer platform") {
const links = [
["llms.txt", "/llms.txt"],
["prompt.txt", "/workers/prompt.txt"],
[`${product.data.name} llms-full.txt`, `/${product.id}/llms-full.txt`],
["Developer Platform llms-full.txt", "/developer-platform/llms-full.txt"],
];

group.entries.push({
type: "group",
label: "LLM resources",
entries: links.map(([label, href]) => ({
type: "link",
label,
href,
isCurrent: false,
attrs: {
target: "_blank",
},
badge: undefined,
})),
collapsed: true,
badge: undefined,
});
}

return group;
}

Expand Down