[@layout]: ../docs.layout.md

# Feeds

Feed publishes an RSS feed from an ordinary query. Readers receive each item's
full text, and pages listed in the feed advertise it to browsers and feed readers.

```sh
bun run pmx plugins add feed
```

Create `paths/blog/rss.feed.md`:

````md
---
title: Field notes
description: Notes on learning design.
category: topic
---

```query
from: .
type: post
sort:
  - by: date
    direction: desc
```
````

Add a post beside it, `paths/blog/first.post.md`:

```md
---
title: First note
description: Why we start with questions.
date: 2026-02-09
author: Ada Lovelace
topic: Craft
---

Every course begins with a question.
```

Run `bun run dev` and open `/blog/rss.xml`. The feed contains **First note**
with its date, author, category and full text. `/blog/first.post` includes
`<link rel="alternate" type="application/rss+xml">` for the feed.

---

## Items

The feed's query decides which Sources appear and in what order. It accepts
`from`, `type`, `where`, `sort`, `limit`, `has` and `recursive`; `from` resolves
beside the feed Source and defaults to its folder. Each feed has exactly one query.

| RSS field | Source value |
| --- | --- |
| Title, description, image | The Source's title, description and image, including their fallbacks to the first heading, paragraph and image |
| Link | The Source's canonical page URL |
| Date | `date`, as a calendar day or a full timestamp |
| Author | `author`, one name or a list |
| Category | The data field named by the feed's `category`, one value or a list |
| Content | The Source's Markdown as HTML |

Content keeps text, headings, lists, quotes, code, links and images. It omits
HTML and components, which do not run in feed readers. A directive link such as
`[@video Launch day](https://youtu.be/…)` keeps its label, *Launch day*. Relative
links and images resolve beside the authored Source and become absolute URLs,
including on folder index pages. Links to other Sources use their page URLs and
keep query parameters and fragments. Static exports apply the publication prefix
to local links and images.

The optional `language` sets the channel language, such as `en-us`. The channel
links to the feed's folder, and its build date is the newest item date.

---

## Publication and access

`/blog/rss.feed.md` serves `/blog/rss.xml` on a live server and in a static export.
The feed Source is also an ordinary page that renders its query. Feeds list only
Sources the reader can see; a static export uses the anonymous View, so private
Sources never appear in a published feed.

Feed URLs use the request origin during development. Set `PATHMX_ORIGIN` in
production, or pass `--origin` to [`pmx export`](../start/publish.guide.md), so
readers receive canonical links.

Run `bun run pmx lint` to find a feed without exactly one valid query.
