JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 62
  • Score
    100M100P100Q57018F
  • License MIT

Build-time llms.txt, llms-full.txt, JSON-LD, markdown mirrors, headers, AI crawler controls, and validation for Vite

Package Exports

  • @agentmarkup/vite

Readme

@agentmarkup/vite

Build-time llms.txt, optional llms-full.txt, JSON-LD, markdown mirrors, AI crawler controls, and validation for Vite websites.

@agentmarkup/vite is the Vite adapter in the agentmarkup package family. Framework-agnostic helpers live in @agentmarkup/core, and Astro sites use @agentmarkup/astro.

Install

pnpm add -D @agentmarkup/vite

Usage

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { agentmarkup } from '@agentmarkup/vite';

export default defineConfig({
  plugins: [
    react(),
    agentmarkup({
      site: 'https://example.com',
      name: 'Example',
      description: 'Machine-readable metadata for an example site.',
      llmsTxt: {
        sections: [
          {
            title: 'Documentation',
            entries: [
              {
                title: 'Getting Started',
                url: '/docs/getting-started',
                description: 'Setup guide and first steps',
              },
            ],
          },
        ],
      },
      llmsFullTxt: {
        enabled: true,
      },
      markdownPages: {
        enabled: true,
      },
      contentSignalHeaders: {
        enabled: true,
      },
      globalSchemas: [
        {
          preset: 'webSite',
          name: 'Example',
          url: 'https://example.com',
        },
        {
          preset: 'organization',
          name: 'Example Inc.',
          url: 'https://example.com',
          logo: 'https://example.com/logo.png',
        },
      ],
      pages: [
        {
          path: '/faq',
          schemas: [
            {
              preset: 'faqPage',
              url: 'https://example.com/faq',
              questions: [
                {
                  question: 'Do you ship internationally?',
                  answer: 'Yes.',
                },
              ],
            },
          ],
        },
      ],
      aiCrawlers: {
        GPTBot: 'allow',
        ClaudeBot: 'allow',
        PerplexityBot: 'allow',
        'Google-Extended': 'allow',
        CCBot: 'disallow',
      },
      validation: {
        warnOnMissingSchema: true,
      },
    }),
  ],
});

What It Does

  • Generates /llms.txt from config
  • Generates optional /llms-full.txt with inlined same-site markdown content
  • Injects the homepage llms.txt discovery link automatically
  • Injects JSON-LD into built HTML pages
  • Validates JSON-LD already present in page HTML
  • Generates .md mirrors from the final HTML output when a cleaner agent-facing fetch path is useful
  • Patches or creates robots.txt with AI crawler directives
  • Patches or creates _headers with Content-Signal and canonical Link headers for markdown mirrors
  • Validates common schema and crawler mistakes at build time
  • Warns when a page looks like a thin client-rendered HTML shell
  • Warns when markdown alternate links or llms.txt mirror coverage drift out of sync
  • Exposes the same generators and validators for custom prerender or post-build scripts

If the page already contains JSON-LD for a schema type, or the site already ships a curated llms.txt or matching crawler rules, the adapter preserves those by default. Set llmsTxt.replaceExisting or jsonLd.replaceExistingTypes only when you want Vite output to replace existing assets.

Markdown mirrors are optional. They are usually most useful for thin, noisy, or client-rendered HTML where the raw page is a weak fetch target for agents. The generated .md files stay directly fetchable for agents, while their _headers entries point search engines back at the HTML page as canonical. Existing files are still preserved unless you opt into replacement with markdownPages.replaceExisting or contentSignalHeaders.replaceExisting.

When markdown mirrors are enabled, same-site page entries in llms.txt automatically point at the generated .md mirrors by default. Set llmsTxt.preferMarkdownMirrors: false if you want llms.txt to keep linking to HTML routes instead.

Enable llmsFullTxt when you want a richer companion file for agents that can consume more than the compact llms.txt manifest. The generated llms-full.txt keeps the same section structure but inlines same-site markdown mirror content when those mirrors exist.

The adapter assumes Vite controls the final HTML output. If a framework does an additional server-render or prerender pass after Vite finishes, use @agentmarkup/core in that final step or reach for a dedicated adapter instead of assuming JSON-LD injection will carry through automatically.

Presets

  • webSite
  • organization
  • article
  • faqPage
  • product
  • offer

You can also pass custom schema objects with your own @type.

Custom Pipelines

If your site already has a final prerender or post-build step, you can reuse the public helpers instead of maintaining a separate llms.txt or robots.txt implementation.

import {
  generateLlmsTxt,
  patchRobotsTxt,
  generateJsonLdTags,
  presetToJsonLd,
  validateLlmsTxt,
  validateRobotsTxt,
} from '@agentmarkup/vite';

const llms = generateLlmsTxt({
  site: 'https://example.com',
  name: 'Example',
  description: 'Machine-readable metadata for an example site.',
  llmsTxt: {
    sections: [
      {
        title: 'Public pages',
        entries: [{ title: 'Pricing', url: '/pricing', description: 'Plans and billing' }],
      },
    ],
  },
});

const robots = patchRobotsTxt(existingRobotsTxt, {
  GPTBot: 'allow',
  ClaudeBot: 'allow',
});

const jsonLd = generateJsonLdTags([
  presetToJsonLd({ preset: 'webSite', name: 'Example', url: 'https://example.com' }),
]);

const llmsIssues = validateLlmsTxt(llms ?? '');
const robotsIssues = validateRobotsTxt(robots, {
  GPTBot: 'allow',
  ClaudeBot: 'allow',
});

Example Output

  @agentmarkup/vite

  ✓ llms.txt generated (6 entries, 2 sections)
  ✓ llms-full.txt generated (6 inlined entries)
  ✓ JSON-LD injected into 1 pages
  ✓ Markdown pages generated (6 files)
  ✓ _headers generated with markdown canonicals (6 files)
  ✓ robots.txt patched (5 AI crawlers configured)
  ✓ _headers generated with Content-Signal

  No issues found

See the example app in the GitHub repo at examples/vite-react.

Maintainer

Copyright (c) 2026 Sebastian Cochinescu. MIT License.

Used in production on Anima Felix.

License

MIT.