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

+4 -2
View File
@@ -24,6 +24,8 @@ import time
from typing import Dict, List, Optional, Tuple
from urllib.parse import parse_qsl, urlsplit
from starpunk.utils import post_path
logger = logging.getLogger(__name__)
RESPONSE_EVENTS = ("reply", "mention", "quote", "like", "repost", "bookmark")
@@ -158,7 +160,7 @@ def _messages(rows, site_url: str, conn) -> List[Tuple[str, str, List[int]]]:
who = (row["author_name"] or "someone") + (f" via {via}" if via else "")
pending = row["moderation_status"] == "pending"
link = (f"{site}/admin/webmentions/{row['id']}" if pending
else f"{site}/note/{row['slug']}#responses")
else f"{site}{post_path(row['slug'], row['note_title'])}#responses")
if row["mention_type"] in GROUPED:
groups.setdefault((row["target_note_id"], row["mention_type"], row["slug"], pending), []).append(
(row["id"], row["author_name"] or "someone", link))
@@ -206,7 +208,7 @@ class Sweeper:
logger.warning(f"Dropped {dropped} notification(s) older than {DROP_AFTER_HOURS} hours")
rows = conn.execute(
"""
SELECT w.*, n.slug FROM webmentions w JOIN notes n ON n.id = w.target_note_id
SELECT w.*, n.slug, n.title AS note_title FROM webmentions w JOIN notes n ON n.id = w.target_note_id
WHERE w.notified_at IS NULL AND w.validation_status = 'valid'
AND w.moderation_status IN ('approved', 'pending')
ORDER BY w.id LIMIT 100