feat: align ActivityPub article previews for Mastodon #226

Merged
erik merged 1 commit from feat/task-e11e34ff-mastodon-article-previews into main 2026-06-28 07:43:59 -05:00
Owner

Summary

  • Align ActivityPub article serialization with the slugkit.com Mastodon preview behavior.
  • Emit URL-only article content and language-tagged contentMap.en via Fedify LanguageString.
  • Avoid article name/summary and image attachments in ActivityPub objects so Mastodon renders a link preview card instead of duplicated status text/media gallery.
  • Extend federation tests for article contentMap, URL-only content, and absence of article image attachment/name/summary.
  • Clarify Mastodon preview cache behavior and redelivery/refetch expectations in the template README.

Verification

  • npm exec --workspace @slugkit/template-site -- vitest run --config ./vitest.config.ts src/routes/tests/public.test.ts src/federation/tests/routes.test.ts
  • npm run typecheck --workspace @slugkit/template-site
  • npm run lint
  • ./scripts/pre-pr.sh

Task: #task-e11e34ff

## Summary - Align ActivityPub article serialization with the slugkit.com Mastodon preview behavior. - Emit URL-only article content and language-tagged `contentMap.en` via Fedify `LanguageString`. - Avoid article `name`/`summary` and image attachments in ActivityPub objects so Mastodon renders a link preview card instead of duplicated status text/media gallery. - Extend federation tests for article `contentMap`, URL-only content, and absence of article image attachment/name/summary. - Clarify Mastodon preview cache behavior and redelivery/refetch expectations in the template README. ## Verification - npm exec --workspace @slugkit/template-site -- vitest run --config ./vitest.config.ts src/routes/__tests__/public.test.ts src/federation/__tests__/routes.test.ts - npm run typecheck --workspace @slugkit/template-site - npm run lint - ./scripts/pre-pr.sh Task: #task-e11e34ff
feat: align ActivityPub article previews for Mastodon
All checks were successful
CI / build-lint-test (pull_request) Successful in 48s
15bd60bc18
Task: #task-e11e34ff
Author
Owner

Review summary

Approved.

Acceptance criteria

  • Generated/template article pages emit og:title, og:description, og:url, og:type, and og:image when available. Evidence: PR #225 already merged this template support; existing public metadata tests continue passing in this PR.
  • og:image and twitter:image are absolute reachable URLs. Evidence: PR #225 route tests assert absolute /media image URLs; unchanged and passing here.
  • twitter:card uses summary_large_image with image and summary otherwise. Evidence: PR #225 route tests cover both cases; unchanged and passing here.
  • ActivityPub article content is URL-only. Evidence: buildActivityPubPostContent() now returns only the post URL anchor for articles; federation route test asserts URL-only content.
  • ActivityPub article objects include language-tagged content / contentMap.en. Evidence: LanguageString(content, "en") is emitted via contents; test asserts contentMap.en for article and note objects.
  • ActivityPub article objects do not include image attachments for article preview cards. Evidence: article objects are created from common fields only, with no attachment generation; test asserts no attachment, name, or summary on the article object.
  • Tests cover article metadata with and without image, ActivityPub contentMap, and absence of article image attachment. Evidence: public metadata tests from PR #225 remain passing; this PR adds federation assertions for contentMap and absent article attachment.
  • Documentation notes Mastodon/link-preview caching and refetch/redelivery. Evidence: README now says to redeliver or refetch ActivityPub posts after preview metadata changes.

Blocking issues

  • None.

Warnings

  • None.

Verification reviewed

  • ./scripts/pre-pr.sh passed locally.
  • Forgejo CI run #314 passed.
  • Diff reviewed with git diff --check main...HEAD.

Final verdict

Approved. Ready for human merge approval.

### Review summary Approved. ### Acceptance criteria - [x] Generated/template article pages emit `og:title`, `og:description`, `og:url`, `og:type`, and `og:image` when available. Evidence: PR #225 already merged this template support; existing public metadata tests continue passing in this PR. - [x] `og:image` and `twitter:image` are absolute reachable URLs. Evidence: PR #225 route tests assert absolute `/media` image URLs; unchanged and passing here. - [x] `twitter:card` uses `summary_large_image` with image and `summary` otherwise. Evidence: PR #225 route tests cover both cases; unchanged and passing here. - [x] ActivityPub article content is URL-only. Evidence: `buildActivityPubPostContent()` now returns only the post URL anchor for articles; federation route test asserts URL-only content. - [x] ActivityPub article objects include language-tagged content / `contentMap.en`. Evidence: `LanguageString(content, "en")` is emitted via `contents`; test asserts `contentMap.en` for article and note objects. - [x] ActivityPub article objects do not include image attachments for article preview cards. Evidence: article objects are created from common fields only, with no attachment generation; test asserts no `attachment`, `name`, or `summary` on the article object. - [x] Tests cover article metadata with and without image, ActivityPub `contentMap`, and absence of article image attachment. Evidence: public metadata tests from PR #225 remain passing; this PR adds federation assertions for `contentMap` and absent article attachment. - [x] Documentation notes Mastodon/link-preview caching and refetch/redelivery. Evidence: README now says to redeliver or refetch ActivityPub posts after preview metadata changes. ### Blocking issues - None. ### Warnings - None. ### Verification reviewed - `./scripts/pre-pr.sh` passed locally. - Forgejo CI run #314 passed. - Diff reviewed with `git diff --check main...HEAD`. ### Final verdict Approved. Ready for human merge approval.
erik merged commit 673095184a into main 2026-06-28 07:43:59 -05:00
erik deleted branch feat/task-e11e34ff-mastodon-article-previews 2026-06-28 07:43:59 -05:00
Sign in to join this conversation.
No reviewers
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!226
No description provided.