Installation
npm create @jaamd sets up a blog in one command. To add JAAB by hand, see
Manual installation; for documentation and a blog on
one site, see Docs and a blog.
Create a project
npm create @jaamd@latest -- --template blog
pnpm create @jaamd@latest --template blog
yarn create @jaamd --template blog
bunx @jaamd/create@latest --template blog
The CLI asks for a destination, title and whether to install dependencies. The
blog template puts the posts at /; --template docs-blog sets up
docs and a blog together, with the docs at / and the blog
at /blog. --here adds them to a repository you already have, without
overwriting a file: see JAAD’s installation
for every option.
Run locally
npm run dev
The development server starts at http://localhost:4321. Add posts to
blog/, following Posts.
Manual installation
Install JAAB in a project on Astro 7, from 7.3, with Node.js 22.23.4 or later:
npm install @jaamd/jaab astro
pnpm add @jaamd/jaab astro
yarn add @jaamd/jaab astro
bun add @jaamd/jaab astro
Tailwind is needed only with tailwind: true:
tailwindcss and @tailwindcss/vite, from 4.3.
Add the following files:
// jaab.config.ts
import { defineJaabConfig } from '@jaamd/jaab'
export default defineJaabConfig({
site: 'https://example.dev',
title: 'My blog',
})
// astro.config.mjs
export { default } from '@jaamd/jaab/site'
// src/content.config.ts
export { collections } from '@jaamd/jaab/content'
// tsconfig.json
{
"extends": "astro/tsconfigs/strict"
}
Only title is required. Every other option is in
Options.
Write the first post with npx jaab new "Hello", then run npx astro dev. See
Posts.
Existing Astro project
If --here reports custom astro.config.* or src/content.config.* files,
keep their existing configuration and merge JAAB manually.
Add the integration to the Astro configuration:
// astro.config.ts
import jaab from '@jaamd/jaab'
import { defineConfig } from 'astro/config'
import jaabConfig from './jaab.config'
export default defineConfig({
site: jaabConfig.site,
base: jaabConfig.base,
integrations: [jaab(jaabConfig)],
})
jaab() returns integrations only. site and base are lifted above. Of the
astro field, only
astro.fonts is read here, to load those fonts on JAAB’s pages: write the
other options, and the same fonts, in defineConfig.
If the project defines content collections, add JAAB’s collections without replacing them:
// src/content.config.ts
import { collections as jaabCollections } from '@jaamd/jaab/content'
import { defineCollection } from 'astro:content'
const notes = defineCollection({/* existing loader and schema */})
export const collections = {
notes,
...jaabCollections,
}
The collection names blogPosts and blogIndex are reserved for JAAB.
The blog’s index takes its routeBase,
/ by default: a site with a home page of its own sets routeBase: '/blog'.
JAAB sets up JAAMD for the Markdown, so remove jaamd() from the
integrations if the project has it: see Layout.
Create blog/, add a post, then run the project with its existing development
script.
Docs and a blog
A site with documentation and a blog installs JAAD and JAAB. They share the
header, the footer, the theme, the fonts and the authors, so they take the
same site options: defineSiteConfig holds them once, and each config spreads
them.
site.config.ts holds the shared options:
import { defineSiteConfig } from '@jaamd/jaab'
export default defineSiteConfig({
title: 'My project',
nav: [
{ label: 'Docs', href: '/' },
{ label: 'Blog', href: '/blog/' },
],
})
astro.config.mjs gives them to both, each with its own options after them:
import jaab from '@jaamd/jaab'
import jaad from '@jaamd/jaad'
import { defineConfig } from 'astro/config'
import site from './site.config.ts'
export default defineConfig({
site: 'https://example.dev',
integrations: [jaad({ ...site, routeBase: '/' }), jaab({ ...site, routeBase: '/blog' })],
})
src/content.config.ts declares the docs and the posts:
import { collections as blog } from '@jaamd/jaab/content'
import { collections as docs } from '@jaamd/jaad/content'
export const collections = { ...docs, ...blog }
The build stops when the two set a site option differently, or when a page of
one would be served inside the other. Search stays on the docs; the feed is
linked from every page; /llms.txt has a section for each.