如何准备 HTTP 响应正文以在 LinkedIn 上展开 URL?
How to prepare HTTP response body for unfurling of URL on LinkedIn?
"Unfurling is the technical term for what happens when you share a link on Twitter, Facebook, LinkedIn or Slack."(摘自本书:设计机器人:创造对话体验
阿米尔谢瓦特)
HTTP 响应正文必须符合什么规范才能在 LinkedIn 上展开 link?
应用程序能够在指定的 URL.
处读取文档 HTML 头部中的元标记,从而展开工作
您列出的大多数服务都将使用and/or后备的一些规范,包括 og (opengraph) 和 twitter。
你的 HTML 头部需要包含这样的东西(对于 opengraph)
<meta property="og:url" content="your website url" />
<meta property="og:title" content="the title that shows up in the unfurled preview" />
<meta property="og:description" content="the description in the preview" />
<meta property="og:image" content="the url of the image you want to show in the preview" />
请注意,如果您要构建 SPA 或基于路由参数动态加载内容的内容,则需要进行服务器端呈现或可以静态服务于 HTML 的内容,因为 unfurl-er 不会 运行 会添加到 DOM.
的 javascript
还有一种称为 oEmbed 的东西,它是与其他服务共享元数据的标准。这将是一个响应 JSON 关于您 post 的链接的服务器。 Slack primarily relies on oEmbed 但如果 og 或 twitter 标签不可用,将返回。
"Unfurling is the technical term for what happens when you share a link on Twitter, Facebook, LinkedIn or Slack."(摘自本书:设计机器人:创造对话体验 阿米尔谢瓦特)
HTTP 响应正文必须符合什么规范才能在 LinkedIn 上展开 link?
应用程序能够在指定的 URL.
处读取文档 HTML 头部中的元标记,从而展开工作您列出的大多数服务都将使用and/or后备的一些规范,包括 og (opengraph) 和 twitter。
你的 HTML 头部需要包含这样的东西(对于 opengraph)
<meta property="og:url" content="your website url" />
<meta property="og:title" content="the title that shows up in the unfurled preview" />
<meta property="og:description" content="the description in the preview" />
<meta property="og:image" content="the url of the image you want to show in the preview" />
请注意,如果您要构建 SPA 或基于路由参数动态加载内容的内容,则需要进行服务器端呈现或可以静态服务于 HTML 的内容,因为 unfurl-er 不会 运行 会添加到 DOM.
的 javascript还有一种称为 oEmbed 的东西,它是与其他服务共享元数据的标准。这将是一个响应 JSON 关于您 post 的链接的服务器。 Slack primarily relies on oEmbed 但如果 og 或 twitter 标签不可用,将返回。