feat(events): show real link previews for shared event links - #536
Merged
Conversation
A pasted ?event=<id> link previewed with the generic Events page title/description/image, not the actual event, since previews are built from server-rendered <meta> tags and the event modal only opens client-side. Adds eventMetaTags() to build a title/description/image from an EventItem, and wires it into both events-new.astro (already fetching events server-side) and events.astro (adds a server-side fetch, but only when ?event= is present, to keep the page's normal client-only load path unchanged).
Deploying website with
|
| Latest commit: |
fb1d3a6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://76a74405.website-aun.pages.dev |
| Branch Preview URL: | https://feat-events-link-preview.website-aun.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
?event=<id>, from the modal's "copy link" button) previewed as the generic "Events" page in Slack/iMessage/social — link previews only ever see server-rendered<meta>tags, and the event modal itself only opens client-side after hydration.eventMetaTags(event)(src/utils/eventMeta.ts) to build a title/description/image from anEventItem(reusingdisplayTitleandgetDescriptionExcerpt), falling back to the site's default OG image when no flyer/thumbnail resolves.events-new.astroalready fetches events server-side, so it just looks up the linked event and overrides theHomeLayouttitle/description/image props when found.events.astrointentionally skips server-side fetching otherwise (client:only page), so it only does the extrafetchEvents()call when?event=is present — normal page loads are unaffected.Test plan
/eventsand/events-newwithout?event=still show the generic Events page preview, unchanged.?event=id falls back to the generic preview without erroring.pnpm checkpasses.