[Skip to content](#_top)

[![OpenNav AI](/_astro/full-open-logo.CGezuffk.svg) OpenNav AI](https://opennav.ai/)

Search CtrlK

Cancel

[Docs](https://docs.opennav.ai/index.md)

[Quick Start](https://docs.opennav.ai/getting-started/index.md)

[SDK](https://docs.opennav.ai/sdk/index.md)

[OpenNav AI on X](https://x.com/OpenNavAI)

[Joshua Bellew on X](https://x.com/manofyear93)

[Email Joshua Bellew](mailto:joshua@opennav.ai)

- Start Here

  - [Overview](https://docs.opennav.ai/index.md)
  - [How It Works](https://docs.opennav.ai/how-it-works/index.md)
  - [Getting Started](https://docs.opennav.ai/getting-started/index.md)

- Use OpenNav

  - [CLI](https://docs.opennav.ai/cli/index.md)
  - [SDK](https://docs.opennav.ai/sdk/index.md)

- Frameworks

  - [Astro](https://docs.opennav.ai/frameworks/astro/index.md)
  - [Next.js](https://docs.opennav.ai/frameworks/next/index.md)
  - [Server-side frameworks Soon](https://docs.opennav.ai/frameworks/server-side/index.md)

- Platforms

  - [Cloudflare](https://docs.opennav.ai/platforms/cloudflare/index.md)

- Reference

  - [Generated Files](https://docs.opennav.ai/reference/generated-files/index.md)
  - [Content Extraction](https://docs.opennav.ai/reference/content-extraction/index.md)
  - [Access Guidance](https://docs.opennav.ai/reference/access-guidance/index.md)

- External

  - [AcceptMarkdown](https://acceptmarkdown.com/)
  - [Cloudflare Agent Readiness](https://blog.cloudflare.com/agent-readiness/)
  - [Is It Agent Ready?](https://isitagentready.com/)

[OpenNav AI on X](https://x.com/OpenNavAI)

[Joshua Bellew on X](https://x.com/manofyear93)

[Email Joshua Bellew](mailto:joshua@opennav.ai)

On this page

- [Overview](#_top)
- [Install](#install)
- [OpenNavStaticSite(options)](#opennavstaticsiteoptions)
  - [siteName](#sitename)
  - [siteUrl](#siteurl)
  - [outputDirectory](#outputdirectory)
  - [preset](#preset)
  - [platform](#platform)
  - [contentExtraction](#contentextraction)
  - [contentExtraction.stripLayout](#contentextractionstriplayout)
  - [staticHeaders](#staticheaders)
  - [staticHeaders.enabled](#staticheadersenabled)
  - [accessGuidance](#accessguidance)
  - [accessGuidance.contentSignals](#accessguidancecontentsignals)
- [build(options)](#buildoptions)
  - [dryRun](#dryrun)

## On this page

- [Overview](#_top)
- [Install](#install)
- [OpenNavStaticSite(options)](#opennavstaticsiteoptions)
  - [siteName](#sitename)
  - [siteUrl](#siteurl)
  - [outputDirectory](#outputdirectory)
  - [preset](#preset)
  - [platform](#platform)
  - [contentExtraction](#contentextraction)
  - [contentExtraction.stripLayout](#contentextractionstriplayout)
  - [staticHeaders](#staticheaders)
  - [staticHeaders.enabled](#staticheadersenabled)
  - [accessGuidance](#accessguidance)
  - [accessGuidance.contentSignals](#accessguidancecontentsignals)
- [build(options)](#buildoptions)
  - [dryRun](#dryrun)

# SDK

Use the root SDK when your script already knows the built output folder.

## Install

[Section titled “Install”](#install)

Install OpenNav before importing `OpenNavStaticSite`.

- [npm](#tab-panel-20)
- [pnpm](#tab-panel-21)
- [yarn](#tab-panel-22)
- [bun](#tab-panel-23)

Terminal window

```txt
npm install @opennav-ai/opennav
```

Terminal window

```txt
pnpm add @opennav-ai/opennav
```

Terminal window

```txt
yarn add @opennav-ai/opennav
```

Terminal window

```txt
bun add @opennav-ai/opennav
```

Quick start

```txt
import { OpenNavStaticSite } from "@opennav-ai/opennav";
const result = await new OpenNavStaticSite({  siteName: "Example Docs",  siteUrl: "https://example.com",  outputDirectory: "dist",}).build();
if (result.isErr()) {  console.error(result.error.message);  process.exit(1);}
console.log(result.value);
```

Full example

```txt
import { OpenNavStaticSite } from "@opennav-ai/opennav";
const result = await new OpenNavStaticSite({  siteName: "Example Docs",  siteUrl: "https://example.com",  outputDirectory: "dist",  preset: "astro",  platform: "cloudflare-pages",  contentExtraction: {    stripLayout: true,  },  accessGuidance: {    contentSignals: {      search: "allow",      aiInput: "allow",      aiTrain: "disallow",    },  },}).build({ dryRun: true });
if (result.isErr()) {  console.error(result.error.message);  process.exit(1);}
console.log(result.value);
```

## `OpenNavStaticSite(options)`

[Section titled “OpenNavStaticSite(options)”](#opennavstaticsiteoptions)

Creates a static-site runner for one built output folder.

```txt
interface OpenNavStaticSiteOptions {  readonly siteName: string;  readonly siteUrl: string;  readonly outputDirectory: string;  readonly preset?: "astro" | "next-export";  readonly platform?: "cloudflare-pages";  readonly contentExtraction?: {    readonly stripLayout?: boolean;  };  readonly staticHeaders?: {    readonly enabled: boolean;  };  readonly accessGuidance?: {    readonly contentSignals?: {      readonly search?: "allow" | "disallow";      readonly aiInput?: "allow" | "disallow";      readonly aiTrain?: "allow" | "disallow";    };  };}
```

### `siteName`

[Section titled “siteName”](#sitename)

Required. Human-readable site or docs name written into generated OpenNav files, including `llms.txt`, page Markdown files, and `.well-known/opennav.json` inside `outputDirectory`.

### `siteUrl`

[Section titled “siteUrl”](#siteurl)

Required. Public absolute URL used for generated links and manifest URLs. The value should include the protocol and host, such as `https://example.com`.

### `outputDirectory`

[Section titled “outputDirectory”](#outputdirectory)

Required. Built static output folder OpenNav scans and updates. In most projects, pass an output-directory-relative path from the script’s working directory, such as `dist`, `out`, or `apps/docs/dist`.

OpenNav reads from and writes to this folder only. Relative paths are resolved by the calling script from the current working directory.

### `preset`

[Section titled “preset”](#preset)

Optional. Framework hint for static-folder conventions.

Supported values are `"astro"` and `"next-export"`. When omitted, OpenNav treats `outputDirectory` as a generic static site folder.

### `platform`

[Section titled “platform”](#platform)

Optional. Static hosting platform for platform-specific generated files.

Supported values are `"cloudflare-pages"`. When `platform: "cloudflare-pages"` is passed, OpenNav creates or updates the Cloudflare Pages `_headers` file by default. That file tells Cloudflare Pages to serve generated Markdown as `text/markdown`, generated `llms` indexes as `text/plain`, and the OpenNav manifest as `application/json`. It also adds per-page HTTP `Link` headers to HTML routes so agents can discover each page’s Markdown alternate and the root `llms.txt` index without parsing the HTML body first.

Omit `platform` for a generic static build. More platform values will be added as OpenNav gains first-class support for additional static hosts.

### `contentExtraction`

[Section titled “contentExtraction”](#contentextraction)

Optional. Controls how OpenNav reads built HTML pages before creating generated Markdown page artifacts and `llms-full.txt`.

When omitted, OpenNav preserves the current conservative behavior: it converts the whole HTML `<body>` to Markdown. Set `stripLayout` to `true` to remove the documented fixed list of layout elements before Markdown conversion.

See the [content extraction reference](https://docs.opennav.ai/reference/content-extraction/index.md) for the exact stripped elements and the cases where you should leave this unset.

This first version uses a fixed strip list. Future versions are expected to add more granular HTML element controls, such as tag-level, class-level, or selector-level strip and preserve rules.

```txt
const result = await new OpenNavStaticSite({  siteName: "Example Docs",  siteUrl: "https://example.com",  outputDirectory: "dist",  contentExtraction: {    stripLayout: true,  },}).build();
```

### `contentExtraction.stripLayout`

[Section titled “contentExtraction.stripLayout”](#contentextractionstriplayout)

Optional. Defaults to `false`.

When `true`, OpenNav still starts from the whole HTML `<body>`, but removes the declared layout elements before converting that body to Markdown.

### `staticHeaders`

[Section titled “staticHeaders”](#staticheaders)

Optional. Controls platform response-header artifacts such as Cloudflare Pages `_headers`.

When omitted, OpenNav uses the configured platform default. The current Cloudflare Pages default is enabled, so `platform: "cloudflare-pages"` creates or updates `_headers` unless you opt out.

If an existing caller-owned `_headers` route overlaps OpenNav’s generated routes, OpenNav leaves `_headers` untouched and reports a warning.

```txt
const result = await new OpenNavStaticSite({  siteName: "Example Docs",  siteUrl: "https://example.com",  outputDirectory: "dist",  platform: "cloudflare-pages",  staticHeaders: {    enabled: false,  },}).build();
```

### `staticHeaders.enabled`

[Section titled “staticHeaders.enabled”](#staticheadersenabled)

Required inside `staticHeaders`. Set to `false` to keep platform metadata such as `platform: "cloudflare-pages"` without creating or editing the platform header file. Set to `true` to explicitly request the platform header file. When `true`, `platform` must also be configured because each host has its own header-file format.

### `accessGuidance`

[Section titled “accessGuidance”](#accessguidance)

Optional. Controls whether OpenNav creates or updates its managed Content Signals block in `robots.txt` inside `outputDirectory`.

When omitted, OpenNav does not create or edit `robots.txt` for access guidance.

### `accessGuidance.contentSignals`

[Section titled “accessGuidance.contentSignals”](#accessguidancecontentsignals)

Optional. Content-use preferences OpenNav writes into `robots.txt`.

At least one nested field must be configured before OpenNav creates or updates its managed Content Signals block.

#### `search`

Optional. Writes `search=yes` for `“allow”` or `search=no` for `“disallow”`. When omitted, OpenNav does not express a search-use preference.

#### `aiInput`

Optional. Writes `ai-input=yes` for `“allow”` or `ai-input=no` for `“disallow”`. When omitted, OpenNav does not express an AI-input preference.

#### `aiTrain`

Optional. Writes `ai-train=yes` for `“allow”` or `ai-train=no` for `“disallow”`. When omitted, OpenNav does not express an AI-training preference.

## `build(options)`

[Section titled “build(options)”](#buildoptions)

Runs OpenNav against the configured output folder.

```txt
interface OpenNavStaticSiteBuildOptions {  readonly dryRun?: boolean;}
```

### `dryRun`

[Section titled “dryRun”](#dryrun)

Optional. Set to `true` to preview created, modified, skipped, and warning paths without changing files.

[PreviousCLI](https://docs.opennav.ai/cli/index.md)

[NextAstro](https://docs.opennav.ai/frameworks/astro/index.md)

---

Site index: [llms.txt](https://docs.opennav.ai/llms.txt)

<!-- opennav compatible="true" version="1.0" profile="static-agent-ready" build-fingerprint="sha256:ef7e48fe34cc" manifest="/.well-known/opennav.json" -->
