JSPM

@waldheimdev/astro-ai-llms-txt

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

Astro Integration: llms.txt generator (AI-optimized summary of all HTML pages)

Package Exports

  • @waldheimdev/astro-ai-llms-txt
  • @waldheimdev/astro-ai-llms-txt/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@waldheimdev/astro-ai-llms-txt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

πŸš€ @waldheimdev/astro-ai-llms-txt

✨ Astro Integration: llms.txt Generator ✨

This plugin magically creates a KI-optimized llms.txt in your build output on every Astro build!
Perfect for SEO, AI crawlers, and anyone who loves content. πŸ¦ΎπŸ“ˆ

🌟 Features

  • 🏷️ Extracts title, description, H1, H2, H3, and all <p> texts from HTML
  • πŸ€– AI-powered summarization via Ollama, OpenAI, or Gemini (provider/model/key/endpoint configurable)
  • πŸ—„οΈ AI response caching (SHA256, .llms-txt-cache in dist)
  • πŸ—‚οΈ Groups entries by root web section (e.g. /blog/, /services/)
  • πŸ›‘οΈ Robust path normalization (OS-independent)
  • πŸͺ² Debug logging, error detection, build abort on errors

⚑ Installation

# npm
npm install @waldheimdev/astro-ai-llms-txt
# pnpm
pnpm add @waldheimdev/astro-ai-llms-txt
# yarn
yarn add @waldheimdev/astro-ai-llms-txt
# bun
bun add @waldheimdev/astro-ai-llms-txt

πŸŽ‰ Usage

Add the plugin to your astro.config.mjs and let the magic begin:

import llmsTxt from '@waldheimdev/astro-ai-llms-txt';

export default {
  integrations: [
    llmsTxt({
      projectName: 'πŸš€ My Project',
      description: 'KI-optimized overview for LLMs. 🧠',
      aiProvider: 'ollama', // 'openai' | 'gemini' | 'ollama'
      aiApiKey: '', // API key for OpenAI/Gemini
      aiModel: 'llama3', // Model name for provider
      site: 'https://my-domain.com', // Base URL for links
      maxInputLength: 8000, // Optional: max length for AI input
    }),
  ],
};

All Options

Option Type Default Description
projectName string 'My Project' Name for the llms.txt header
description string 'KI-optimized overview for LLMs.' Description for llms.txt header
aiProvider string 'ollama' AI provider: 'ollama', 'openai', or 'gemini'
aiApiKey string '' API key for OpenAI or Gemini (not needed for Ollama)
aiModel string 'llama3' Model name for the selected provider
aiUrl string '' Custom endpoint for Ollama (optional)
site string '' Base URL for links in llms.txt
maxInputLength number 8000 Maximum input length for AI summarization

πŸ“¦ Output

After every Astro build you'll find in dist/:

  • llms.txt – Your KI-optimized overview of all pages ✨
  • .llms-txt-cache/ – Cache for AI responses πŸ—„οΈ

πŸ› οΈ Extending

  • Want more AI providers? Just add them in src/aiProvider.ts! 🧩
  • Tests & coverage: npm test βœ…
  • Linting: npm run lint 🧹

πŸ“ Example llms.txt

# πŸš€ My Project

> KI-optimized overview for LLMs. 🧠

## Blog

- [/blog/post-1]: Post title summary...
- [/blog/post-2]: Post title summary...

## Services

- [/services/web]: Web service summary...

Note: llms.txt complements existing standards like robots.txt and sitemap.xml, providing LLMs with a curated, AI-optimized overview. Learn more at llmstxt.org

Made with ❀️ for Astro & AI enthusiasts!

Need help or find a bug?

Please open an issue on GitLab or submit a merge request. We appreciate your feedback!

Or contact me on my Website. You need my service? Let's talk!