| disclaimer | this is an experiment, not guaranteed to work as it depends on how the ai crawls your website. It will hopefully become more useful as time passes and standards are created and adopted |
|---|
(no it's not an acronym)
madao is a tiny Astro integration that injects a <link rel="alternate" type="text/markdown" …> tag into every rendered HTML page. The tag points to a generated Markdown representation of the page under a /md/ folder, making the site AI‑ready: LLMs can consume the raw Markdown alongside the HTML. It also generates llms.txt and llms-full.txt to assure compatibility with more ai-bots.
We are bound to become "totally hopeless old guy"s as AI will replace us and we lose our job, kinda like Hasegawa from (Gintama). And also MD-AI is written similar to madao.
- Zero‑config: add the integration to your
astro.config.mjsand the middleware is wired automatically. - SSR‑friendly: runs as an Astro middleware, works with static builds and server‑side rendering.
- Markdown export: on
astro:build:doneyou can implement a conversion pipeline that writes the page HTML to Markdown files underdist/md/. - Developer tooling: includes Biome for lint/format, Changesets for versioning & releasing, and a CI workflow.
npm i -D astro-madao
# install peer dependency if you haven't already
npm i astroAdd the integration to astro.config.mjs:
import { defineConfig } from "astro";
import madao from "astro-madao";
export default defineConfig({
integrations: [madao()],
});You don't have to configure Madao, but you may want to personalize some settings:
| Option | Default Value | What it Does |
|---|---|---|
folder |
"md" |
Sets the name of the subfolder where the generated Markdown files will be placed. |
title |
(your homepage title) | Sets the site title for the llms.txt and llms-full.txt files. |
description |
(your homepage description) | Sets the site description for llms.txt and llms-full.txt. |
excludePaths |
[] (empty list) |
List of URL patterns to exclude from Markdown file generation (e.g., folders you don't want exported). |
Example:
integrations: [madao({
folder: 'ai',
title: 'Madao',
excludePaths: 'homeworks'
})],
});The middleware will automatically append a <link> tag pointing to the Markdown file for the current page. You can then flesh out the astro:build:done hook to generate those Markdown files.
# lint & format
npm run lint
npm run format
# build
npm run buildWe use Changesets to manage releases:
# create a changeset
npm run changeset
# version bump & changelog generation
npm run version
# publish to npm
npm run releaseThe CI workflow runs lint, type‑checking and the build on every push.
- [] Next update: handle i18n better
