Files
volumen/docs/api-reference.md
T
petrbalvinandQwen-Coder 5437cef1cd feat: add fediverse_creator handle for Mastodon attribution
Expose a per-post fediverse_creator frontmatter field plus a site-wide
default in config.toml ([site].fediverse_creator). The handle is returned
in the post and site payloads, rendered as <dc:creator> in the RSS feed
and as authors[].name in the JSON feed, so a front-end can drop it into
<meta name="fediverse:creator"> on rendered pages. Per-post value
overrides the site default. Validated against a simple @user@host regex.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-06-26 17:40:48 +02:00

100 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# API Reference
> Status: the public read API (`/api/volumen`) and the admin (`/admin`) are
> implemented. The admin is server-rendered HTML, not part of the JSON API.
Base path: `/api/volumen`. All responses are JSON unless noted. Read endpoints
send `Access-Control-Allow-Origin: *`.
## `GET /api/volumen/site`
Returns site metadata from the configuration.
```json
{
"title": "My Blog",
"description": "A blog powered by volumen.",
"base_url": "https://example.com",
"language": "en",
"author": "Anonymous",
"fediverse_creator": "@petrbalvin@mastodon.social"
}
```
`fediverse_creator` is `null` when the site-wide default is not set; a per-post
value (see below) takes precedence when present.
## `GET /api/volumen/posts`
Paginated list of published posts (drafts are excluded), newest first.
Posts with `all_langs = true` in their frontmatter match every `lang` filter.
| Name | Type | Default | Description |
|-------|--------|---------|--------------------|
| lang | string | — | Filter by language |
| tag | string | — | Filter by tag |
| page | int | 1 | Page number |
| limit | int | 20 | Per page (1100) |
```json
{
"page": 1,
"page_size": 20,
"total": 1,
"posts": [
{
"slug": "hello",
"title": "Hello",
"excerpt": "Hello world.",
"date": "2026-01-15",
"lang": "en",
"tags": ["intro"],
"author": null,
"fediverse_creator": null,
"cover": null,
"reading_time": 1,
"translations": {},
"url": "/api/volumen/posts/hello"
}
]
}
```
## `GET /api/volumen/posts/{slug}`
Single post including the raw Markdown body and rendered HTML. Optional
`?lang=` selects a translation. Returns `404` with `{"error":"not_found"}` if
no match.
```json
{
"slug": "hello",
"title": "Hello",
"excerpt": "Hello world.",
"date": "2026-01-15",
"lang": "en",
"tags": ["intro"],
"author": null,
"fediverse_creator": "@petrbalvin@mastodon.social",
"cover": null,
"reading_time": 1,
"translations": {},
"url": "/api/volumen/posts/hello",
"body": "Hello **world**.",
"html": "<p>Hello <strong>world</strong>.</p>\n"
}
```
## `GET /api/volumen/tags`
Tag cloud with counts (published posts only), most frequent first.
```json
{ "tags": [{ "name": "intro", "count": 1 }] }
```
## `GET /api/volumen/feed.xml`, `GET /api/volumen/sitemap.xml`
RSS 2.0 feed (latest 20 posts) and a sitemap of post URLs, built from
`site.base_url`.