feat: article titles and summaries stored apart from the text (v2.16.0, ADR-076)

Articles as the IndieWeb defines them: a name separate from the content.

- Migration 023 adds notes.title and notes.summary. A one-time Python data
  step (migrations.DATA_MIGRATIONS) moves each note's '# Heading' first line
  into title, rewrites the file and hash, empties FTS for a rebuild, and puts
  files back if the migration fails. Trashed notes included.
- Micropub: name -> title, summary stored when sent with content, summary
  updatable, q=source returns both. MCP tools take a summary.
- Feeds: titles only for articles (RSS/JSON none, Atom empty); Atom and
  JSON Feed summaries; the title is no longer repeated in the content.
- Pages: p-name/p-summary on the article page. Homepage and tag pages show
  articles as title, summary and "Read more" without images (hidden u-photo
  keeps the post type for parsers).
- Crossposts: articles go out as title, summary, link and hashtags, no
  images; the Bluesky card is the article. Notes unchanged.
- Editor: Title and Summary fields; an article may have no body.
- Fix: a line starting with a hashtag ('#indieweb ...') was rendered as a
  heading and crossposted without its '#' (HashtagLineExtension).
- Fix: excerpts showed raw Markdown; they are plain text now.

Back up the database and the data folder before deploying: the migration
rewrites note files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-11 17:05:38 -07:00
1 parent 9a0d82bab2
commit 978c13358b
44 files changed
+943 -356

No files matched your search

+20 -7
View File
@@ -128,6 +128,7 @@ def create_note_submit():
media_files: Multiple file upload (v1.2.0 Phase 3)
captions[]: Captions for each media file (v1.2.0 Phase 3)
tags: Comma-separated tag list (v1.3.0 Phase 3)
title, summary: Optional; a title makes it an article (v2.16.0)
Returns:
Redirect to dashboard on success, back to form on error
@@ -141,17 +142,19 @@ def create_note_submit():
published = "published" in request.form
custom_slug = request.form.get("custom_slug", "").strip()
tags_input = request.form.get("tags", "")
title = request.form.get("title", "").strip() or None
summary = request.form.get("summary", "").strip() or None
if not content:
flash("Content cannot be empty", "error")
# With photos, WebSub hears about the note once they're attached (v2.10.1)
has_uploads = any(f.filename for f in request.files.getlist('media_files'))
if not (content or title or has_uploads):
flash("A note needs text, a title or an image", "error")
return redirect(url_for("admin.new_note_form"))
# Parse tags (v1.3.0 Phase 3)
tags = parse_tag_input(tags_input)
# With photos, WebSub hears about the note once they're attached (v2.10.1)
has_uploads = any(f.filename for f in request.files.getlist('media_files'))
try:
# Create note first (per Q4)
note = create_note(
@@ -160,6 +163,8 @@ def create_note_submit():
custom_slug=custom_slug if custom_slug else None,
tags=tags if tags else None,
has_media=has_uploads,
title=title,
summary=summary,
)
# Handle media uploads (v1.2.0 Phase 3)
@@ -279,12 +284,14 @@ def update_note_submit(note_id: int):
content: Updated markdown content (required)
published: Checkbox for published status (optional)
tags: Comma-separated tag list (v1.3.0 Phase 3)
title, summary: Empty removes them; a form without the field leaves them (v2.16.0)
Returns:
Redirect to dashboard on success, back to form on error
Decorator: @require_auth
"""
from starpunk.notes import UNCHANGED
from starpunk.tags import parse_tag_input
# Check if note exists first
@@ -296,8 +303,12 @@ def update_note_submit(note_id: int):
content = request.form.get("content", "").strip()
published = "published" in request.form
tags_input = request.form.get("tags", "")
title = request.form["title"].strip() if "title" in request.form else UNCHANGED
summary = request.form["summary"].strip() if "summary" in request.form else UNCHANGED
has_title = existing_note.title if title is UNCHANGED else title
if not content and not existing_note.reacts_to: # likes/reposts may have no comment
# Likes/reposts may have no comment, articles no body
if not content and not (existing_note.reacts_to or has_title):
flash("Content cannot be empty", "error")
return redirect(url_for("admin.edit_note_form", note_id=note_id))
@@ -311,7 +322,9 @@ def update_note_submit(note_id: int):
published=published,
# An empty Tags field removes all tags (v2.14.1); a form without
# the field leaves them alone
tags=tags if "tags" in request.form else None
tags=tags if "tags" in request.form else None,
title=title,
summary=summary,
)
if "syndication_form" in request.form:
from starpunk.syndication import select_targets