A friend sends you a link to a template. You open it and land on an empty editor. Now you have to ask which template they meant.
PasteCharm's Bio builder already gives each public template a stable ID. The reading template, for example, has the ID books_reading. A share link can open that card using a fragment in the URL. The editor still waits for you to click Use this template before it replaces anything. Reading template example
The useful bit is what the URL carries. It gets the ID of a public example and a fixed source marker. It never reads the editor. A name or description someone is working on stays out of the URL, the clipboard payload for this action, and the share sheet.
Open the share sheet from the click
Here's a smaller version of the browser logic. Pass it the URL you already built for the public template. Call it from the Share button's click handler.
async function shareTemplate(url, browser = navigator) { const data = { title: 'Reading journal template', url }; const canShare = typeof browser.share === 'function' && (typeof browser.canShare !== 'function' || browser.canShare(data)); if (canShare) { try { await browser.share(data); return 'share-resolved'; } catch (error) { if (error?.name === 'AbortError') return 'share-aborted'; } } try { await browser.clipboard.writeText(url); return 'link-copied'; } catch { return 'show-link-for-manual-copy'; } } When there's no native share support, the clipboard gives the user something they can paste into whichever app they want. If the clipboard write fails too, show a selectable link. The return value in this example tells your UI which feedback to show.
One case is easy to miss: dismissing the share sheet. If the user hits Cancel, silently replacing their clipboard would be a surprise. AbortError can also mean the browser had no available share targets. The example stops in both cases. If that happens often for your users, a separate Copy link action gives them an explicit way out. MDN on Web Share exceptions
Test the recipient's side too
A link can copy successfully and still leave the recipient looking at the wrong thing. In our regression test, the sender writes a private draft, shares the reading template, and checks the copied URL. Then the test opens that URL and verifies that the template is visible and the editor's default text is intact until the recipient chooses to apply it.
That check also helped define what to measure. A share-sheet request tells us someone tried to share. A clipboard write tells us the link was copied. The action that matters on the other side is whether a visitor opened the tagged link and applied the template. Those are three separate observations. A resolved Web Share promise is especially easy to overread because when it resolves varies across platforms. MDN on Web Share return values
This article was drafted with AI using PasteCharm’s implementation and tests as references.