关于使用 rel="share-url" 来暴露分享意图如何?
What about using rel="share-url" to expose sharing intents?

原始链接: https://shkspr.mobi/blog/2025/08/what-about-using-relshare-url-to-expose-sharing-intents/

## ShareOpenly:网页分享标准化提案 目前,在社交媒体上分享网站链接的方式各不相同,每个平台都需要不同的输入格式(仅URL、URL与文本,或仅文本)。Ben Werdmuller的“ShareOpenly”提出了一种解决方案:一种网站*暴露*现有分享机制的标准化方法。 该想法围绕着网站头部一个新的`

## Hacker News 讨论:分享意图与 Web 标准 Hacker News 的讨论围绕着在网页上暴露分享功能的方法。最初的帖子建议使用 `rel="share-url"` 来定义外部网站如何构建分享内容的 URL。然而,评论者们大多认为现有的 **Web Share Target API** (一个自 2019/2021 年起在基于 Chromium 的浏览器中实现的 W3C 规范) 是一个更优的解决方案,它提供了原生浏览器/平台集成。 有人对 Web Share Target API 缺乏功能检测以及潜在的可访问性问题(特别是屏幕阅读器处理多个分享目标时)表示担忧。一些人认为提出的 `rel="share-url"` 更易于理解,但另一些人批评它是一种潜在的低效设计,需要浏览器获取和解析外部页面。 对话还涉及社交媒体分享按钮的普及以及隐私影响,一些人认为用户主要还是复制/粘贴链接。 许多评论者指出,即使是没有在这些平台上注册账户的用户,分享按钮也经常被用于追踪。最终,讨论质疑在现有解决方案或简单的 URL 复制已经足够的情况下,是否有必要开发新的分享机制。
相关文章

原文

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}">

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!

联系我们 contact @ memedata.com