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

+34
View File
@@ -121,6 +121,40 @@ class TestCompose:
assert "…" in text
class TestArticles:
"""Articles are crossposted as title, teaser and link, without images (v2.16.0)"""
LINK = "https://blog.example.com/note/x"
def test_title_summary_and_link(self, app):
with app.app_context():
note = create_note(content="Long body " * 100, title="My Article",
summary="The gist.", published=True)
text = compose_text(note, self.LINK, ["IndieWeb"], 500)
assert text == f"My Article\n\nThe gist.\n\n{self.LINK}\n\n#IndieWeb"
def test_without_summary_the_start_of_the_text(self, app):
with app.app_context():
note = create_note(content="Some *markdown* " + "word " * 100, title="T", published=True)
title, teaser, link = compose_text(note, self.LINK, [], 5000).split("\n\n")
assert (title, link) == ("T", self.LINK)
assert teaser.startswith("Some markdown word") and teaser.endswith("…")
assert len(teaser) <= 201
def test_edit_follows_and_no_images(self, app, server, monkeypatch):
looked_up = []
monkeypatch.setattr(syndication, "_media_files", lambda *a, **k: looked_up.append(a) or [])
with app.test_request_context():
note = create_note(content="Body", title="Before", published=True)
select_targets(note.id, ["gotosocial"])
process_due()
update_note(id=note.id, title="After")
process_due()
assert server.statuses["1"]["status"].startswith("After\n\nBody")
assert not server.statuses["1"].get("media_ids")
assert looked_up == []
class TestLifecycle:
def test_publish_creates_status(self, app, server):
note = publish(app, tags=["Test"])