Skip to content

bskyweb: add video objects to jsonld SEO - #10814

Merged
blackmichael merged 4 commits into
mainfrom
app-2279
Jun 10, 2026
Merged

blackmichael merged 4 commits into
mainfrom
app-2279

Conversation

@blackmichael

@blackmichael blackmichael commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Adds schema.org VideoObject to the JSON-LD blob bskyweb already emits for posts and profiles. When a post has a video embed, the DiscussionForumPosting (and Comment, and profile hasPart[]) entries now include a video field with @type: VideoObject, name, description, thumbnailUrl, uploadDate, contentUrl (HLS playlist), embedUrl (canonical post URL), and width/height when the aspect ratio is available.

  • Refactors video-embed lookup into a shared findVideoEmbed helper used by both extractVideoMeta (og:video) and buildVideoObject (JSON-LD), so the two outputs cannot drift.
  • name falls back to Video by @<handle> when alt text is empty, then to Video on Bluesky for handle.invalid. description falls back to name when post text is empty, so Google rich-result requirements are always satisfied.
  • Honors the existing embedHidden gate (self/post-view labels) so labeled posts do not surface video metadata.
  • duration is omitted because the appview does not expose it.

Tests

@linear-code

linear-code Bot commented Jun 9, 2026

Copy link
Copy Markdown

APP-2279

@github-actions

github-actions Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor
Old size New size Diff
7.75 MB 7.75 MB 0 B (0.00%)

@blackmichael

Copy link
Copy Markdown
Contributor Author

@claude plz review

@claude

claude Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @blackmichael's task in 2m 2s —— View job


Code review

  • Read changed files (embedmeta.go, jsonld.go, jsonld_test.go)
  • Review logic, correctness, and edge cases
  • Cross-check against schema.org VideoObject requirements
  • Post review

Summary

Nice refactor — pulling findVideoEmbed out of extractVideoMeta and sharing it with buildVideoObject is the right move; the two outputs are now structurally guaranteed to agree on whether a post has a video at all. Fallback chain (alt → Video by @handle → Video on Bluesky) and the empty-text→name description fallback satisfy Google's rich-result requirements. Test coverage is good (alt+aspect, both fallbacks, no playlist, hidden embed, record-with-media, reply, profile hasPart).

A few things worth a look:

1. embedUrl will be empty when the post's handle is handle.invalid

buildPostNode (bskyweb/cmd/bskyweb/jsonld.go:438-449) computes postURL via bskyPostURLFromATURI, which returns "" for handle.invalid per bskyPostURL (jsonld.go:131), then passes that as embedURL to buildVideoObject. With omitempty on EmbedURL, the video object on a handle.invalid post will have neither contentUrl-only is sometimes treated as a weaker rich-result signal by Google, and the surrounding discussionForumPosting.URL already falls back to the canonical URL in buildPostJSONLD (jsonld.go:538-540) — but that fallback doesn't propagate down to Video.EmbedURL.

You already have TestBuildPostJSONLD_HandleInvalidAuthor; consider either (a) passing the resolved post URL (canonical-form-fallback) into buildVideoObject, or (b) deriving the fallback inside buildVideoObject from pv.Uri/DID. Probably (a) — feed it the already-fallback node.URL.

2. contentUrl is the HLS playlist (.m3u8)

Google's video indexer docs ask contentUrl to be "the URL pointing to the actual video media file" in a supported encoding format, with HLS/DASH manifests being a known grey area (some properties get indexed, some don't). embedUrl (an HTML page with the player) is the more reliable signal for Bluesky's stack. Worth a short comment on videoObject.ContentURL noting the choice (and that the appview has no direct-media URL to offer) so future readers don't second-guess it.

3. width / height semantics

schema.org/VideoObject's width/height mean pixel dimensions. The appview's AspectRatio field name is misleading — the lexicon says it carries pixel counts, but many clients normalize to a reduced ratio like 16/9 before upload, in which case Google sees a 16×9-pixel video. Not a blocker (it's still a valid declaration of the ratio), but for sites that surface aspect ratio specifically the Rich Results test sometimes flags low absolute pixel counts as suspicious. Consider either omitting width/height entirely, or only emitting them when both values exceed, say, 100 (i.e. clearly pixel counts and not a reduced ratio).

4. uploadDate = pv.IndexedAt

IndexedAt is the appview's index timestamp, not when the video was uploaded. For most posts these are the same minute, but for backfilled or relay-delayed records they can diverge significantly. pv.Record.Val.(*appbsky.FeedPost).CreatedAt would be semantically closer to "uploadDate", with IndexedAt as a fallback if CreatedAt is missing or implausibly in the future. The existing DatePublished field on the post already uses IndexedAt, so there's a consistency argument for the current choice — fine to leave, but worth a comment.

5. Minor: buildVideoObject doesn't trim alt text

If a poster pastes a multi-kilobyte alt blob (unusual, but no enforcement), it lands verbatim in name. Google's title fields are de-facto short. A strings.TrimSpace plus a soft cap (e.g. first 110 chars) would be defensive without changing typical output. Optional.

6. Tests look good

The video-on-reply test (jsonld_test.go:1277) and the record-with-media test (jsonld_test.go:1251) cover the important fan-out cases. One small gap: there's no test covering EmbedURL for a handle.invalid author — adding one would have caught issue #1 above.

Nits

  • videoObject doc comment (jsonld.go:72) mentions duration omission, good — also worth noting interactionStatistic is omitted (Google recommends it for videos; viewCount via WatchAction is possible if/when the appview exposes it).
  • buildVideoObject signature (jsonld.go:215) takes postText even though that text is already available on the parent node. Not wrong, just a minor coupling — keeps the helper standalone, which is probably worth it.

Overall LGTM with #1 worth fixing before merge.
• Branch: app-2279

@arcalinea
arcalinea temporarily deployed to app-2279 - social-app PR #10814 June 9, 2026 20:50 — with Render Destroyed

@estrattonbailey estrattonbailey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one question

Comment thread bskyweb/cmd/bskyweb/jsonld.go Resolved
Comment thread bskyweb/cmd/bskyweb/jsonld.go Resolved
@arcalinea
arcalinea temporarily deployed to app-2279 - social-app PR #10814 June 10, 2026 18:25 — with Render Destroyed
@blackmichael
blackmichael merged commit 3095bbf into main Jun 10, 2026
19 checks passed

This branch was successfully deployed

No deployments
app-2279 - social-app PR #10814 — d503e44e Deployed Jun 10, 2026 by arcalinea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants