Terence Eden. He has a beard and is smiling.
Theme Switcher:

What about using rel="share-url" to expose sharing intents?

· 13 comments · 450 words · Viewed ~7,892 times


Let's say that you've visited a website and want to share it with your friends. At the bottom of the article is a list of popular sharing destinations - Facebook, BlueSky, LinkedIn, Telegram, Reddit, HackerNews etc.

Screenshot. "Share this page on" followed by colourful icons for popular social networks.

You click the relevant icon and get taken to the site with the sharing details pre-filled.

Screenshot of the Telegram sharing page.

The problem is, every different site has a different intent for sharing links and text. For example:

  • https://www.facebook.com/sharer.php?u=…&t=…
  • https://www.linkedin.com/sharing/share-offsite/?url=…
  • https://bsky.app/intent/compose?text=…
  • https://www.threads.net/intent/post?url=…&text=…
  • https://www.reddit.com/submit?url=…&title=…

As you can see, some only allow a URL, some text and a URL, and some just a plain text which could contain the URl. A bit of a mess! It's probably impossible to get every site to agree on a standard for their sharing intent. But there could be a standard for exposing their existing sharing mechanism.

That's the proposal from Ben Werdmuller with "Share Openly".

ShareOpenly knows about most major social networks, as well as decentralized platforms like Mastodon, Bluesky, and Known.

However, if ShareOpenly is having trouble sharing to your platform, and if your platform supports a share intent, you can add the following metatag to your page headers:

<link rel="share-url" href="https://your-site/share/intent?text={text}">

Where https://your-site/share/intent?text= is the URL of your share intent.

The special keyword {text} will be replaced with the URL and share text.

I think that's a pretty nifty solution.

For sites which take a URl and an (optional) title, the meta element looks like:

 HTML<link rel="share-url" href="https://www.facebook.com/sharer.php?u={url}&t={text}">
<link rel="share-url" href="https://lemmy.world/create_post?url={url}&title={text}">

For those which only take URl, it looks like:

 HTML<link rel="share-url" href="https://www.linkedin.com/sharing/share-offsite/?url={url}">

It's slightly trickier for sites like Mastodon and BlueSky which only have a text sharing field and no separate URl. The current proposal is just to use the text. For example

 HTML<link rel="share-url" href="https://bsky.app/intent/compose?text={text}">

But it could be something like

 HTML<link rel="share-url" href="https://mastodon.social/share?text={text}%0A{url}">

What Next?

The HTML specification has this to say about adding new link types:

Extensions to the predefined set of link types may be registered on the microformats page for existing rel values.

Adding to that page merely requires a formal specification to be written up. After that, some light lobbying might be needed to get social networks to adopt it.

So, I have three questions for you:

  1. Do you think <link rel="share-url" is a good idea for a new standard?
  2. What changes, if any, would you make to the above proposal?
  3. Would you be interested in using it - either as a sharer or sharing destination?

Please leave a comment in the box - and remember to hit those sharing buttons!


Share this post on…

13 thoughts on “What about using rel="share-url" to expose sharing intents?”

  1. @Edent I am not sure I understand.

    1. If I understand it correctly, this would need to be implemented by websites that "receive" the share data. Eg. Facebook or a Mastodon instance?

    2. If 1. is true, then who would consume this link tag and act on it? Individual websites like yours? A service like shareopenly? The user agent, eg. the browser? When? How often?

    3. If 1. is false and this is meant to be implemented on the share source (eg. your website), then what's the advantage over the links you have at the bottom of your post? Again, who is meant to consume the (hidden) link tags?

    4. Finally, more philosophically, are share links actually used? I feel like people usually either share things manually (or via their Mobile OS share mechanism) or not at all. I don't remember ever using one of those links.

    Reply | Reply to original comment on fedi.splitbrain.org

  2. Nice idea but this:

    "Extensions to the predefined set of link types may be registered on the microformats page for existing rel values."

    is very, very, very foolish.

    Who runs that page/ site? How are they accountable? How are disputes (for example over which extensions to include on or exclude from that page) managed?

    Reply

  3. Feels analogous to opensearch.xml which lets browsers support site-search: has a similar templating syntax

    Is this for browsers or other websites to consume though?

    Your browser could store "openshare.xml" of sites you visit, and then surface them natively, but that's a much bigger spec challenge

    Reply | Reply to original comment on bsky.app

  4. @dalias @Edent I see. So I need to actively add share targets. Probably in a similar way that I need to allow web notifications or install a site as a PWA.

    Now it is already possible to register a PWA as a share target for mobile phones (using the share_target in the manifest). And there is also the JavaScript share API (https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share), so I feel like all that is missing is better support for the latter on Desktop?

    Actually the share_target and the manifest.json is probably the better implementation than a new link element: https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Manifest/Reference/share_target

    Reply | Reply to original comment on fedi.splitbrain.org

  5. Any such standard should expicitly state that Link: HTTP headers are an equivalent method for specifying such metadata. For some sites, adding a header is probably easier to implement. And when this doesn't get specified, sometimes we get partially-implemented standards.

    The alternative would be a .well-known URL, e.g. .well-known/share, which contains the posting specification. But I think the approach you propose, with its placeholders, is preferable.

    So yes: this seems good to me!

    Reply

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.

See allowed HTML elements: <a href="" title="">
<abbr title="">
<acronym title="">
<b>
<blockquote cite="">
<br>
<cite>
<code>
<del datetime="">
<em>
<i>
<img src="" alt="" title="" srcset="">
<p>
<pre>
<q cite="">
<s>
<strike>
<strong>

To respond on your own website, write a post which contains a link to this post - then enter the URl of your page here. Learn more about WebMentions.