# Posts

> Write a post: its file, its date and the fields it can set.

A post is a Markdown file in `blog/`. Its URL, below the blog's
[`routeBase`](https://docs.jaamd.org/jaab/configuration/routebase.md), is its file name without the
date in front, if there is one: `2026-11-22-introducing-jaab.md` and
`introducing-jaab.md` are both `/introducing-jaab/`. A post with images beside
it is a directory with an `index.md`: `introducing-jaab/index.md` is
`/introducing-jaab/` too.

A folder of posts keeps its path in the URL: `notes/2026-11-22-tea.md` is
`/notes/tea/`. Only the file name loses its date.

`jaab new` writes a post, dated today:

```bash
npx jaab new "Introducing JAAB"
npx jaab new "Photos from the trip" --dir
```

It writes in `blog/` and does not read `jaab.config.ts`: with another
[`blogDir`](https://docs.jaamd.org/jaab/configuration/blogdir.md), pass it as `--blog-dir`. In a
blog of several [languages](https://docs.jaamd.org/jaab/guides/languages.md), pass the post's as
`--lang it`.

## Frontmatter

```yaml
---
title: Introducing JAAB
date: 2026-11-22
tags: [jaab, release]
---
```

| Field            | Required | Use                                                                                      |
| ---------------- | -------- | ---------------------------------------------------------------------------------------- |
| `date`           | yes      | the order of the posts; a day, or a time with its offset                                 |
| `title`          | no       | otherwise the first `#` heading of the file                                              |
| `description`    | no       | in the index, the feed and the page's metadata                                           |
| `tags`           | no       | in the metadata and the feed only: never shown on the page                               |
| `keywords`       | no       | in the page's metadata only, beside the tags                                             |
| `authors`        | no       | keys of the site's `authors`, names, or `{ name, url }`                                  |
| `aliases`        | no       | old URLs of the post, each redirected to it                                              |
| `lastUpdated`    | no       | shown as "Updated" at the end of the post                                                |
| `ogImage`        | no       | the image for social previews; the site's otherwise                                      |
| `translationKey` | no       | pairs [translations](https://docs.jaamd.org/jaab/guides/languages.md) whose names differ |

Without a `description`, the index shows the text before a `<!-- more -->` line,
or else the first paragraph.

`authors` names who wrote the post. Each entry is a key of the site's
[`authors`](https://docs.jaamd.org/jaad/configuration/authors.md), a name, or a
name with a url. The names are shown beside the date, each one with a url as a
link, and they go in the post's metadata and in the feed. A post without
`authors` has the blog's default [`author`](https://docs.jaamd.org/jaab/configuration/author.md);
`authors: []` names nobody, even then.

A post shows the day its `date` is written on, whatever the time and its offset:
`2026-11-23T00:30:00+01:00` is shown as Nov 23. The time orders posts of the
same day.

A link to another post's file, such as `[the move](2026-11-23-oxlint.md)`,
becomes that post's URL; a link to a file that does not exist stops the
build.

There are no drafts: keep a post out of `blog/` until it is ready.

## The index

`blog/index.md` is the text above the list: its title heads the index, and its
description is the page's. In a blog of several languages, each has its own, as
`blog/it/index.md`.

## Migrating

Posts from Astro's blog template, Jekyll or Hugo need these fields renamed in
their frontmatter:

| From                  | Field              | In JAAB       |
| --------------------- | ------------------ | ------------- |
| Astro's blog template | `pubDate`          | `date`        |
| Astro's blog template | `updatedDate`      | `lastUpdated` |
| Astro's blog template | `heroImage`        | `ogImage`     |
| Jekyll, Hugo          | `categories`       | `tags`        |
| Jekyll, Hugo          | `permalink`, `url` | `aliases`     |

A post takes the URL of its file name. To keep an old URL, list it in
`aliases`, as a path below the blog's `routeBase`: it redirects to the post and
stays out of the sitemap.
