feat: hidden keywords

This commit is contained in:
Alexander Belanger
2026-03-12 15:53:40 -04:00
parent e2e256f3b4
commit 656fb356b5
6 changed files with 42 additions and 8 deletions

View File

@@ -0,0 +1,19 @@
/**
* Keywords component — visually hidden, but indexed with high weight in
* the MiniSearch search index. Place at the bottom of a docs page to
* boost discoverability for synonyms and alternate phrasings.
*
* Usage:
* <Keywords keywords="overview, introduction, concepts, use cases" />
*
* The `generate-llms` script extracts the `keywords` prop and stores it in
* a dedicated high-boost field in the search index. The component itself
* renders a visually-hidden element so the text is never seen by readers.
*/
export default function Keywords({ keywords }: { keywords: string }) {
return (
<span style={{ display: "none" }} aria-hidden="true">
{keywords}
</span>
);
}

View File

@@ -144,7 +144,7 @@ function processTerm(term: string): string | null {
* as single tokens so that code-pattern queries match precisely.
*/
export const MINISEARCH_OPTIONS = {
fields: ["title", "content", "codeIdentifiers"] as string[],
fields: ["title", "content", "codeIdentifiers", "keywords"] as string[],
storeFields: ["title", "pageTitle", "pageRoute"] as string[],
processTerm,
};
@@ -153,7 +153,7 @@ export const MINISEARCH_OPTIONS = {
* Default search options for querying the index.
*/
export const SEARCH_OPTIONS = {
boost: { title: 2, codeIdentifiers: 3 },
boost: { title: 2, codeIdentifiers: 3, keywords: 5 },
prefix: true,
fuzzy: 0.2,
combineWith: "OR" as const,

View File

@@ -4,6 +4,7 @@ asIndexPage: true
import { Callout } from "nextra/components";
import LanguageSwitcher from "@/components/LanguageSwitcher";
import Keywords from "@/components/Keywords";
# What is Hatchet?
@@ -31,7 +32,7 @@ All tasks and workflows are **defined as code**, making them easy to version, te
While Hatchet is a general-purpose orchestration platform, it's particularly well-suited for:
- **AI agents** — Hatchet's durability features allow agents to automatically checkpoint their current state and pickup where they left off when faced with unexpected errors. Hatchet's observability features and distributed-first approach are built for debugging long-running agents at scale.
- **AI agents** — Hatchet's durability features allow agents to automatically checkpoint their current state and pick up where they left off when faced with unexpected errors. Hatchet's observability features and distributed-first approach are built for debugging long-running agents at scale.
- **Massive parallelization** - Hatchet is built to handle millions of parallel task executions without overloading your workers. Worker-level slot control allows your workers to only accept the amount of work they can handle, while features like [fairness](/v1/concurrency) and [priorities](/v1/priority) are built to help scale massively parallel ingestion.
- **Mission-critical workloads** - everything in Hatchet is durable by default. This means that every task, DAG, event or agent invocation is stored in a durable event log and ready to be replayed at some point in the future.
@@ -39,9 +40,9 @@ While Hatchet is a general-purpose orchestration platform, it's particularly wel
If you plan on self-hosting or have requirements for an on-premise deployment, there are some additional considerations:
🐘 **Minimal Infra Dependencies** - Hatchet is built on top of PostgreSQL and for simple workloads, [it's all you need](/self-hosting/hatchet-lite).
**Minimal Infra Dependencies** - Hatchet is built on top of PostgreSQL and for simple workloads, [it's all you need](/self-hosting/hatchet-lite).
⬆️ **Fully Featured Open Source** - Hatchet is 100% MIT licensed, so you can run the same application code against [Hatchet Cloud](https://cloud.onhatchet.run) to get started quickly or [self-host](/self-hosting) when you need more control.
**Fully Featured Open Source** - Hatchet is 100% MIT licensed, so you can run the same application code against [Hatchet Cloud](https://cloud.onhatchet.run) to get started quickly or [self-host](/self-hosting) when you need more control.
## Production Readiness
@@ -57,4 +58,4 @@ Hatchet has been battle-tested in production environments, processing billions o
Get started quickly with the **[Hatchet Cloud Quickstart](/v1/quickstart)** or **[self-hosting](/self-hosting)**.
Keywords: overview, introduction, concepts, use cases, production readiness, self hosting
<Keywords keywords="overview, introduction, concepts, use cases, production readiness, self hosting" />

View File

@@ -6,6 +6,7 @@ import { snippets } from "@/lib/generated/snippets";
import { Snippet } from "@/components/code";
import { Callout, Card, Cards, Steps, Tabs } from "nextra/components";
import UniversalTabs from "../../components/UniversalTabs";
import Keywords from "@/components/Keywords";
# Hatchet Cloud Quickstart
@@ -110,4 +111,4 @@ And that's it! You should now have a Hatchet project set up on Hatchet Cloud wit
Once you've completed the quickstart, continue to the next section to learn how to [create your first task](/v1/tasks).
Keywords: quickstart, cloud, getting started, installation, trigger
<Keywords keywords="quickstart, cloud, getting started, installation, trigger" />

View File

@@ -8,6 +8,7 @@ import {
ClaudeCodeTabLabel,
OtherAgentsTabLabel,
} from "@/components/McpSetup";
import Keywords from "@/components/Keywords";
# Using Coding Agents
@@ -150,4 +151,4 @@ For any AI tool that supports [llms.txt](https://llmstxt.org/), Hatchet docs are
Every documentation page also includes a `<link rel="alternate" type="text/markdown">` header
pointing to its markdown version, and a "View as Markdown" link at the top of the page.
Keywords: mcp, skills, cursor, claude code, llms.txt
<Keywords keywords="mcp, skills, cursor, claude code, llms.txt" />

View File

@@ -652,10 +652,20 @@ interface SearchDoc {
title: string;
content: string;
codeIdentifiers: string;
keywords: string;
pageTitle: string;
pageRoute: string;
}
/**
* Extract the keywords string from a <Keywords keywords="..." /> component
* in raw MDX source. Returns an empty string if none is found.
*/
function extractKeywords(rawMdx: string): string {
const match = rawMdx.match(/<Keywords\s+keywords=["']([^"']*)["']\s*\/>/);
return match ? match[1] : "";
}
/**
* Extract compound code identifiers from fenced code blocks in markdown.
* Finds dotted identifiers (e.g. hatchet.task, ctx.spawn, hatchet.workflow)
@@ -789,6 +799,7 @@ function buildSearchIndex(
const urlPath = page.href.replace(DOCS_BASE_URL + "/", "");
const pageRoute = `hatchet://docs/${urlPath}`;
const keywords = extractKeywords(raw);
const sections = splitByH2(md);
for (const section of sections) {
@@ -812,6 +823,7 @@ function buildSearchIndex(
title,
content: section.content,
codeIdentifiers: extractCodeIdentifiers(section.content),
keywords,
pageTitle: page.title,
pageRoute,
});