feat: articles at /article/<slug> with slugs from their titles (v2.17.0, ADR-077)

Articles (notes with a title) move from /note/<slug> to /article/<slug>;
the other prefix 301-redirects. New articles take their slug from the
title (mp-slug still wins; notes keep timestamp slugs). A Micropub update
that adds or removes a title answers 201 with the new Location.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-12 12:27:31 -07:00
1 parent 66aecc2bcb
commit b7f8e1612c
26 files changed
+308 -60

No files matched your search

@@ -1,7 +1,7 @@
# ADR-062: Timestamp-Based Slug Format
## Status
Accepted (Supersedes ADR-007)
Accepted (Supersedes ADR-007). Articles take their slug from the title since v2.17.0 ([ADR-077](ADR-077-article-urls-and-title-slugs.md)).
## Context
@@ -4,6 +4,8 @@
Accepted (v2.16.0, 2026-11-11)
Article URLs (`/article/<slug>`) and title slugs: [ADR-077](ADR-077-article-urls-and-title-slugs.md) (v2.17.0).
Supersedes the v2.3.3 design ([micropub-title-and-source-url](../design/v2.3.3/2026-10-31-micropub-title-and-source-url.md))
and Q22's "a note has a title when its content starts with `#`". Amends
ADR-014 (feed item titles) and ADR-040 (`p-name` and `p-summary`).
@@ -0,0 +1,46 @@
# ADR-077: Article URLs and slugs from titles
## Status
Accepted (v2.17.0, 2026-11-12)
Amends ADR-062 (default slugs) for articles and ADR-076 (articles).
## Context
ADR-076 (v2.16.0) made a note with a title an article, but articles still got
a `/note/<timestamp>` URL like any other note. An article is not a note, and
its URL should say so. ADR-062 chose timestamp slugs because short notes have
no good words for a URL and their text may be private; an article has a title
written to be read, and that is the usual source of its slug on the IndieWeb.
## Decision
- **URLs.** Articles live at `/article/<slug>`, other notes at `/note/<slug>`.
`Note.permalink`, `Note.url`, `Note.endpoint` and `utils.post_path` /
`post_url` build them; nothing else writes `/note/` by hand. Slugs stay
unique across both, so a slug still names one post.
- **One URL each, the other redirects.** `/note/<slug>` for an article and
`/article/<slug>` for a note answer 301 to the right one. Adding or removing
a title changes the URL, and links made before (webmentions sent, crossposts,
bookmarks) keep working. A deleted post is 410 at either.
- **Slug from the title.** When a post is created with a title and no
`mp-slug`, the slug is the title made URL-safe (`sanitize_slug`: accents
folded, lowercase, hyphens), cut at a word boundary to 80 characters, `-2`,
`-3`… if taken, `-article` if reserved. A title with nothing usable (only
emoji, say) falls back to the timestamp slug. Notes keep timestamp slugs.
- **Slugs don't follow later title changes.** Editing an article's title, or
making a note an article, keeps its slug: a slug is the stable part of the
URL.
- **Micropub.** `Location` and `q=source` give the new URLs. Updates accept
either URL. An update that adds or removes a title answers 201 with the new
URL in `Location`, as the Micropub spec requires when a post's URL changes;
other updates are still 204.
- **Incoming webmentions** to either URL find the post.
## Consequences
- Production had no articles when this shipped, so no published URL changed.
- A note given a title later keeps its timestamp slug under `/article/`.
- Stored URLs (webmention sources, crosspost records) are not rewritten; the
redirects cover them.
+5 -4
View File
@@ -5,8 +5,8 @@ records one decision: its context, what was decided, and the consequences.
Superseded ADRs are kept as history; their Status line names the ADR that
replaced them.
**Total ADR files**: 72 (71 numbers: ADR-001 to ADR-044 and ADR-050 to
ADR-076, with two files numbered ADR-012). See [Numbering](#numbering).
**Total ADR files**: 73 (72 numbers: ADR-001 to ADR-044 and ADR-050 to
ADR-077, with two files numbered ADR-012). See [Numbering](#numbering).
Status values: **Accepted** (in force), **Superseded** (replaced by a later
ADR), **Deprecated** (withdrawn, nothing replaces it; none at present),
@@ -48,7 +48,7 @@ See also [database architecture](../architecture/database.md).
| ADR | Title | Status | Summary |
|---|---|---|---|
| [062](ADR-062-timestamp-based-slug-format.md) | Timestamp-Based Slug Format | Accepted | Default slugs are `YYYYMMDDHHMMSS` timestamps (v1.5.0); replaces ADR-007. |
| [062](ADR-062-timestamp-based-slug-format.md) | Timestamp-Based Slug Format | Accepted* | Default slugs are `YYYYMMDDHHMMSS` timestamps (v1.5.0); replaces ADR-007. Articles take theirs from the title (ADR-077). |
| [035](ADR-035-custom-slugs.md) | Custom Slugs in Micropub | Accepted* | Honour `mp-slug`, sanitized, with reserved names protected (v1.1.0). |
| [034](ADR-034-full-text-search.md) | Full-Text Search with SQLite FTS5 | Accepted | FTS5 search over note content (v1.1.0). |
| [057](ADR-057-media-attachment-model.md) | Media Attachment Model | Accepted | Social-media-style image attachments: up to 4 per note, ordered, with captions. |
@@ -69,6 +69,7 @@ See also [database architecture](../architecture/database.md).
|---|---|---|---|
| [040](ADR-040-microformats2-compliance.md) | Strict Microformats2 Compliance | Accepted* | Full h-entry, h-card and h-feed markup (v1.3.0, reviewed v2.8.0); `p-name`/`p-summary` per ADR-076. |
| [076](ADR-076-note-title-and-summary-columns.md) | Article titles and summaries stored apart from the text | Accepted | `notes.title`/`summary` columns; feeds title only articles; article previews and crossposts are title + summary (v2.16.0). |
| [077](ADR-077-article-urls-and-title-slugs.md) | Article URLs and slugs from titles | Accepted | Articles at `/article/<slug>` with slugs from their titles; the other prefix redirects (v2.17.0). |
| [061](ADR-061-author-discovery.md) | Author Profile Discovery from IndieAuth | Accepted | The author h-card is read from `ADMIN_ME` and cached. |
| [063](ADR-063-webmention-implementation.md) | Webmention Implementation | Accepted | Async receiving (202) and sending via a background worker, SSRF guard, rate limits, moderation (v1.6.0, revised up to v2.10.1). *Reconstructed.* |
| [028](ADR-028-micropub-implementation.md) | Micropub Implementation Strategy | Accepted* | `/micropub` endpoint for creating posts (v1.0.0-rc.1); tokens now per ADR-064. |
@@ -171,7 +172,7 @@ was carried out and is not itself superseded.
## How to create a new ADR
1. Use the next number after the highest existing one (currently ADR-076).
1. Use the next number after the highest existing one (currently ADR-077).
2. Name it `ADR-NNN-brief-descriptive-title.md`.
3. Follow the format of recent ADRs (e.g. ADR-070, ADR-071):
@@ -0,0 +1,23 @@
# v2.17.0: Article URLs and title slugs
Implements ADR-077. Follow-up to v2.16.0 (ADR-076): articles had `/note/`
URLs and timestamp slugs.
## What changed
| Area | Change |
|---|---|
| URL helpers | `utils.post_path(slug, title)` and `post_url(slug, title)`; `Note.permalink` uses them, `Note.endpoint` (`public.article`/`public.note`) and `Note.url` (absolute) are new |
| Routes | `public.article` at `/article/<slug>`; `note` and `article` share `_permalink(slug, endpoint)`, which 301s to the other route when the post's type doesn't match. `_note_was_deleted` checks both URLs for hard-deleted posts |
| Slugs | `slug_utils.generate_title_slug(title, existing)`; `create_note` uses it for titled posts without `custom_slug`, else the timestamp slug |
| Micropub | `Location`, `q=source` url via `note.url`; `_note_from_url` accepts `/article/`; update answers 201 + `Location` when a title is added or removed |
| Other URL builders | Templates (`note.url`), webmention sending (`post_url`/`note.url`), crosspost permalink, backfeed target, notification links, search results (`article_title` from `notes.title`), MCP tools |
| Webmention receiving | `resolve_target_note` accepts `/note/` and `/article/` |
## Tests
`tests/test_articles.py::TestArticleUrls`: Micropub URL and slug, timestamp
slugs for notes, redirects both ways, updates via the old URL, slug rules
(accents, duplicates, reserved, `mp-slug`, emoji, long titles), 201 on
adding/removing a title, 410 for a deleted article, webmention targets and
homepage links, search result URLs.