From ea8f56ecbea82892a0d0796e78d62cc5c739e9ac Mon Sep 17 00:00:00 2001 From: Joe Blau Date: Sat, 26 Sep 2026 14:25:41 -0700 Subject: [PATCH] feat(docs): make the Hyperliquid SDK docs agent-ready - llms.txt with when-to-use guidance, call examples, and every docs page (generated from the docs source) - llms-full.txt with every page's Markdown, links made absolute - sitemap.xml with lastmod for every page - SoftwareApplication + Organization (with contactPoint) + WebSite JSON-LD on the homepage - llms.txt alternate link on every page; footer links to About, Contact, Privacy, llms.txt - branded 404 page linking the docs, sitemap, and llms.txt - unit tests for the generators; verify-export now gates on the agent files; CI runs the tests Co-Authored-By: Claude Opus 5.5 --- .github/workflows/docs.yml | 4 + website/app/global.css | 10 ++ website/app/llms-full.txt/route.ts | 10 ++ website/app/llms.txt/route.ts | 8 ++ website/app/not-found.tsx | 38 ++++++ website/app/page.tsx | 18 ++- website/app/sitemap.ts | 11 ++ website/lib/agent-pages.ts | 30 +++++ website/lib/agent.test.ts | 124 ++++++++++++++++++ website/lib/agent.ts | 197 +++++++++++++++++++++++++++++ website/lib/social.ts | 3 +- website/package.json | 1 + website/scripts/verify-export.ts | 75 ++++++++++- 13 files changed, 524 insertions(+), 5 deletions(-) create mode 100644 website/app/llms-full.txt/route.ts create mode 100644 website/app/llms.txt/route.ts create mode 100644 website/app/not-found.tsx create mode 100644 website/app/sitemap.ts create mode 100644 website/lib/agent-pages.ts create mode 100644 website/lib/agent.test.ts create mode 100644 website/lib/agent.ts diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1118e343..addfb6ab 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -66,6 +66,10 @@ jobs: working-directory: website run: bun run check + - name: Test documentation website helpers + working-directory: website + run: bun run test + - name: Build static documentation website working-directory: website run: bun run build diff --git a/website/app/global.css b/website/app/global.css index bb406508..350294ff 100644 --- a/website/app/global.css +++ b/website/app/global.css @@ -169,6 +169,11 @@ textarea:focus-visible { line-height: 1.7; color: var(--color-text-muted); } +.hero-description a { + color: var(--color-accent); + text-decoration: underline; + text-underline-offset: 3px; +} .hero-actions { display: flex; align-items: center; @@ -389,6 +394,11 @@ textarea:focus-visible { .landing-footer a:hover { color: var(--color-accent); } +.footer-links { + display: flex; + flex-wrap: wrap; + gap: --spacing(4); +} /* Entrance: three attention layers, 200 ms apart — headline, then supporting copy and actions, then the code window. `translate` composes with the code window's resting `transform`. */ diff --git a/website/app/llms-full.txt/route.ts b/website/app/llms-full.txt/route.ts new file mode 100644 index 00000000..39befba8 --- /dev/null +++ b/website/app/llms-full.txt/route.ts @@ -0,0 +1,10 @@ +import { llmsFullText } from "@/lib/agent"; +import { agentPagesWithMarkdown } from "@/lib/agent-pages"; + +export const dynamic = "force-static"; + +export async function GET() { + return new Response(llmsFullText(await agentPagesWithMarkdown()), { + headers: { "Content-Type": "text/plain; charset=utf-8" }, + }); +} diff --git a/website/app/llms.txt/route.ts b/website/app/llms.txt/route.ts new file mode 100644 index 00000000..d5264087 --- /dev/null +++ b/website/app/llms.txt/route.ts @@ -0,0 +1,8 @@ +import { llmsText } from "@/lib/agent"; +import { agentPages } from "@/lib/agent-pages"; + +export const dynamic = "force-static"; + +export function GET() { + return new Response(llmsText(agentPages()), { headers: { "Content-Type": "text/plain; charset=utf-8" } }); +} diff --git a/website/app/not-found.tsx b/website/app/not-found.tsx new file mode 100644 index 00000000..4fd15864 --- /dev/null +++ b/website/app/not-found.tsx @@ -0,0 +1,38 @@ +import { HomeLayout } from "fumadocs-ui/layouts/home"; +import { ArrowRight } from "lucide-react"; +import type { Metadata } from "next"; +import Link from "next/link"; +import { baseOptions } from "@/lib/layout.shared"; + +export const metadata: Metadata = { title: "Page not found", robots: { index: false } }; + +export default function NotFound() { + const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? ""; + return ( + +
+
+
+

+ 404 · PAGE NOT FOUND +

+

This page does not exist.

+

+ The Hyperliquid SDK documentation has no page at this address. It may have moved. Start from the docs, or + use the sitemap or llms.txt{" "} + to find every page. +

+
+ + Open the docs + + + Back to home + +
+
+
+
+
+ ); +} diff --git a/website/app/page.tsx b/website/app/page.tsx index 3962afdd..13114617 100644 --- a/website/app/page.tsx +++ b/website/app/page.tsx @@ -2,6 +2,7 @@ import { HomeLayout } from "fumadocs-ui/layouts/home"; import { ArrowRight, ArrowUpRight } from "lucide-react"; import Link from "next/link"; import { InstallCommand } from "@/components/install-command"; +import { homeStructuredData, jsonLdScript, organization } from "@/lib/agent"; import { baseOptions } from "@/lib/layout.shared"; const features = [ @@ -28,6 +29,11 @@ const features = [ export default function Home() { return ( +