Skip to content

Share posts to LinkedIn and other apps, from the feed and a post's page - #63

Merged
vijayakrishnans merged 4 commits into
mainfrom
feat/share-posts
Dec 3, 2026
Merged

vijayakrishnans merged 4 commits into
mainfrom
feat/share-posts

Conversation

@vijayakrishnans

Copy link
Copy Markdown
Collaborator

What

  • Feed: every post card's footer has a Share button next to React and Comment.
  • A post's own page: the old Share only copied the link. It now opens the full share control.
  • The product header's Share gets the longer list too.

The share control offers:

  1. The browser's own share sheet on phones, Safari and Edge, which reaches every app the reader has installed.
  2. The address, with Copy.
  3. Links to: LinkedIn (first), X, Facebook, WhatsApp, Bluesky, Threads, Reddit, Telegram, Email.

Still no widget and no third-party script (RE3's zero third-party requests): each destination is a plain <a href> that leaves only when clicked, with rel="noreferrer noopener". Mastodon is still left out, for the documented reason.

LinkedIn previews

A post's page had no Open Graph tags, so a shared link showed up as the site's generic card. It now sets og:title and og:description from the post, og:type=article, og:url, and uses the product's existing card (/og/product/<slug>) as the image, with a twitter large-image card. This only happens where the deployment has a canonical origin, the same gate as canonical.

Changes

  • packages/contracts/src/share.ts: shareIntents goes from 3 to 9 destinations, plus a new postShareText (headline — product), and every origin is listed in SHARE_INTENT_ORIGINS.
  • web/src/app/[slug]/share-control.tsx: a look="row" option (icon plus word, fills its cell) and align for which edge the panel hangs from.
  • web/src/app/posts/post-footer.tsx: Share, only when the site knows its origin. The share={false} prop is used by the composer's draft preview.
  • web/src/app/[slug]/posts/[id]/page.tsx: ShareControl in the React / Comment / Share row; Open Graph tags.

Tests

  • share.test.ts: the destination list and order, every link pointing at a declared origin and carrying the address, and postShareText.
  • post-page.test.ts: the post page uses ShareControl and sets article OG tags.
  • New post-share-feed.test.ts: the feed footer's Share uses the post's own address and text, is hidden without an origin, and is off on the draft preview.
  • Contracts 1326, web 2148. Typecheck and lint pass.

Security (OWASP)

  • A03: every value in a share URL is encodeURIComponent-ed and the URL is built from the post's server-side address. Nothing typed by a visitor goes in.
  • A05: no third-party script or request. noreferrer means a destination isn't told which page someone was reading.

🤖 Generated with Claude Code

vijayakrishnans and others added 4 commits December 3, 2026 18:21
Every post in the feed now has a Share button in its footer, and a post's
own page swaps its copy-only Share for the full control: the browser's own
share sheet, Copy, and plain links to LinkedIn, X, Facebook, WhatsApp,
Bluesky, Threads, Reddit, Telegram and email. Still no widget and no
third-party script: each is an <a href> that only leaves on a click.

A post's page now tells the networks what to show (og:title, description,
type article, url, and the product's card as the image), so a LinkedIn
share unfurls as the post rather than as the site.

- contracts: shareIntents grows from three to nine (LinkedIn first);
  postShareText; SHARE_INTENT_ORIGINS lists each
- ShareControl: a `row` look (icon and word) and panel alignment
- PostFooter: Share, only where the site knows its public origin; off on
  the composer's draft preview

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…links

The control builds the links in the browser from url and text when it
is given none, so the home page's HTML does not carry nine share links
per card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured in CI: / 168,987 B of JS and 18,270 of document; the product
tabs 184,445; Talk 188,653; the post's page 189,752; /submit 181,178.
Each limit moves to the measurement plus ~100 B.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vijayakrishnans
vijayakrishnans merged commit ac7f47d into main Dec 3, 2026
18 checks passed
@vijayakrishnans
vijayakrishnans deleted the feat/share-posts branch December 3, 2026 12:06
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.

1 participant