Port Mastodon article preview fixes from slugkit.com #222

Closed
opened 2026-06-28 01:28:51 -05:00 by erik · 2 comments
Owner

Problem

slugkit.com needed several fixes before Mastodon rendered article previews correctly. The core/template slugkit project should receive the same pattern so generated Slugkit sites do not repeat the issue.

Reference implementation/workspace:

~/Private/code/forgejo/slugkit.com/

Relevant final behavior from slugkit.com:

  • Public article pages emit OpenGraph/Twitter card metadata with absolute URLs.
  • Article preview image comes from the article banner/first markdown image where available.
  • ActivityPub article content is URL-only so Mastodon does not duplicate title/excerpt above the card.
  • ActivityPub objects include language-tagged contentMap.en so Mastodon does not show an unwanted Translate control.
  • ActivityPub article objects do not include image attachment, because that makes Mastodon render a media gallery where clicking opens the image instead of the article.
  • Mastodon should render one clickable article card with image/title/excerpt that opens the article URL.

Scope

  • Inspect the final slugkit.com implementation and port the appropriate template/core changes into slugkit.
  • Add OpenGraph/Twitter metadata support for generated public post/article pages.
  • Add article image discovery for preview metadata, preferring banner/first markdown image where applicable.
  • Update ActivityPub article object generation to use URL-only content plus language-tagged contentMap.en.
  • Ensure ActivityPub article objects do not serialize image attachments for link-card previews.
  • Preserve existing post rendering, feeds, and ActivityPub delivery behavior except for the intended preview changes.
  • Add/adjust tests for public metadata and ActivityPub object serialization.

Acceptance criteria

  • Generated/template article pages emit og:title, og:description, og:url, og:type, and og:image when an image is available.
  • og:image and twitter:image are absolute reachable URLs.
  • twitter:card uses summary_large_image when an image exists and summary otherwise.
  • ActivityPub article content is URL-only to avoid duplicating card title/excerpt in Mastodon status text.
  • ActivityPub article objects include language-tagged content / contentMap.en.
  • ActivityPub article objects do not include image attachments for article preview cards.
  • Tests cover article metadata with and without image, ActivityPub contentMap, and absence of article image attachment.
  • Documentation notes Mastodon/link-preview caching and the need to redeliver/refetch after preview changes.
## Problem `slugkit.com` needed several fixes before Mastodon rendered article previews correctly. The core/template `slugkit` project should receive the same pattern so generated Slugkit sites do not repeat the issue. Reference implementation/workspace: `~/Private/code/forgejo/slugkit.com/` Relevant final behavior from `slugkit.com`: - Public article pages emit OpenGraph/Twitter card metadata with absolute URLs. - Article preview image comes from the article banner/first markdown image where available. - ActivityPub article content is URL-only so Mastodon does not duplicate title/excerpt above the card. - ActivityPub objects include language-tagged `contentMap.en` so Mastodon does not show an unwanted Translate control. - ActivityPub article objects do **not** include image `attachment`, because that makes Mastodon render a media gallery where clicking opens the image instead of the article. - Mastodon should render one clickable article card with image/title/excerpt that opens the article URL. ## Scope - Inspect the final `slugkit.com` implementation and port the appropriate template/core changes into `slugkit`. - Add OpenGraph/Twitter metadata support for generated public post/article pages. - Add article image discovery for preview metadata, preferring banner/first markdown image where applicable. - Update ActivityPub article object generation to use URL-only content plus language-tagged `contentMap.en`. - Ensure ActivityPub article objects do not serialize image attachments for link-card previews. - Preserve existing post rendering, feeds, and ActivityPub delivery behavior except for the intended preview changes. - Add/adjust tests for public metadata and ActivityPub object serialization. ## Acceptance criteria - Generated/template article pages emit `og:title`, `og:description`, `og:url`, `og:type`, and `og:image` when an image is available. - `og:image` and `twitter:image` are absolute reachable URLs. - `twitter:card` uses `summary_large_image` when an image exists and `summary` otherwise. - ActivityPub article content is URL-only to avoid duplicating card title/excerpt in Mastodon status text. - ActivityPub article objects include language-tagged content / `contentMap.en`. - ActivityPub article objects do not include image attachments for article preview cards. - Tests cover article metadata with and without image, ActivityPub `contentMap`, and absence of article image attachment. - Documentation notes Mastodon/link-preview caching and the need to redeliver/refetch after preview changes.
Author
Owner

Synced from todu comment by @todu on 2026-06-28T12:44:17.345Z

Closing summary

  • PR #226 was merged into main.
  • Local main is aligned with origin/main at merge commit 6730951.
  • Prior review recorded Forgejo CI passing, approval, and acceptance criteria 8/8 met.

Acceptance criteria verified:

  • Generated/template article pages emit OpenGraph metadata with image metadata where available.
  • og:image and twitter:image are absolute URLs.
  • twitter:card uses summary_large_image with images and summary without images.
  • ActivityPub article content is URL-only.
  • ActivityPub article objects include language-tagged contentMap.en.
  • ActivityPub article objects do not include image attachments for preview cards.
  • Tests cover public metadata and ActivityPub serialization behavior.
  • Documentation notes Mastodon/link-preview caching and redelivery/refetch expectations.

Closing task as done.

_Synced from todu comment by @todu on 2026-06-28T12:44:17.345Z_ ### Closing summary - PR #226 was merged into `main`. - Local `main` is aligned with `origin/main` at merge commit `6730951`. - Prior review recorded Forgejo CI passing, approval, and acceptance criteria 8/8 met. Acceptance criteria verified: - Generated/template article pages emit OpenGraph metadata with image metadata where available. - `og:image` and `twitter:image` are absolute URLs. - `twitter:card` uses `summary_large_image` with images and `summary` without images. - ActivityPub article content is URL-only. - ActivityPub article objects include language-tagged `contentMap.en`. - ActivityPub article objects do not include image attachments for preview cards. - Tests cover public metadata and ActivityPub serialization behavior. - Documentation notes Mastodon/link-preview caching and redelivery/refetch expectations. Closing task as done.
Author
Owner

Synced from todu comment by @todu on 2026-06-28T12:43:38.126Z

Review update

  • PR: #226 is open with Forgejo CI passing.
  • Result: approved.
  • Follow-up: waiting for explicit human merge approval.

Acceptance criteria: 8/8 met. Blocking issues: 0. Warnings: 0.

_Synced from todu comment by @todu on 2026-06-28T12:43:38.126Z_ ### Review update - PR: https://forge.caradoc.com/erik/slugkit/pulls/226 is open with Forgejo CI passing. - Result: approved. - Follow-up: waiting for explicit human merge approval. Acceptance criteria: 8/8 met. Blocking issues: 0. Warnings: 0.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
erik/slugkit#222
No description provided.