<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>Link Metadata</title>
  <abstract>This specification describes how to attach metadata for links to a message.</abstract>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.</permissions>
<warranty>## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##</warranty>
<liability>In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.</liability>
<conformance>This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <number>xxxx</number>
  <status>ProtoXEP</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XMPP IM</spec>
    <spec>RDF/XML</spec>
    <spec>OpenGraph</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>link-metadata</shortname>
  
  <author>
    <firstname>Stephen Paul</firstname>
    <surname>Weber</surname>
    <email>singpolyma@singpolyma.net</email>
    <jid>singpolyma@singpolyma.net</jid>
  </author>

  <revision>
    <version>0.0.1</version>
    <date>2026-01-30</date>
    <initials>spw</initials>
    <remark><p>First draft.</p></remark>
  </revision>
</header>
<section1 topic="Introduction" anchor="intro">
  <p>It is common in many chat systems to show a "link preview" or other metadata about IRIs in or related to a message. This metadata is commonly generated from the resource that can be retreived from the resource that can be found at the IRI, for example if it is an HTTPS URL there are three common ways to get this metadata:</p>
  <ol>
    <li>Recipient retreives the URL on their device and extracts metadata according to their own algorithms</li>
    <li>Intermediating server retreives the URL and injects metadata into the message</li>
    <li>Sender retreives the URL and injects metadata into the message</li>
  </ol>
  <p>The first option does not require specification and is entirely client-side by the recipient. This specification defines a format for injection in the other two cases.</p>
</section1>
<section1 topic="Requirements" anchor="reqs">
  <ul>
    <li>Metadata should be able to describe any IRI</li>
  </ul>
</section1>
<section1 topic="Use Cases" anchor="usecases">
  <section2 topic="Injecting Metadata" anchor="inject">
    <p>When an entity wishes to add metadata describing an IRI to a message, they first must generate this metadata somehow. This is out of scope for this document. After this is done they append to the message stanza a child <tt>&lt;Description&gt;</tt> in namespace <tt>http://www.w3.org/1999/02/22-rdf-syntax-ns#</tt> which MUST have a namespaced attribute <tt>about</tt> <strong>in the same namespace</strong> (MUST have a specified namespace). The <tt>about</tt> attribute specifies what IRI this metadata is about.</p>
    <p>Inside the <tt>&lt;Description&gt;</tt> element there may be any elements in any namespaces (<link url="https://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML</link><note>RDF/XML: <link url="https://www.w3.org/TR/rdf-syntax-grammar/">https://www.w3.org/TR/rdf-syntax-grammar/</link></note>-compatible namespaces suggested), in order to allow for extensible metadata about this IRI.</p>
    <p>One very useful vocabulary for use in this context which SHOULD be supported is <span class="ref"><link url="https://ogp.me/">OpenGraph</link></span> <note>OpenGraph: <link url="https://ogp.me/">https://ogp.me/</link></note> which uses namespace <tt>https://ogp.me/ns#</tt>.</p>
<example caption="An example metadata about a webpage"><![CDATA[
<message to='romeo@montague.lit' type='chat'>
  <body>I wanted to mention https://the.link.example.com/what-was-linked-to</body>
  <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:og="https://ogp.me/ns#" rdf:about="https://the.link.example.com/what-was-linked-to">
    <og:title>The Best Webpage</og:title>
    <og:description>This is a great webpage and you will really like it</og:description>
    <og:url>https://example.com/canonical-url/for/what-was-linked-to</og:url>
    <og:image>https://link.to.example.com/image.png</og:image>
    <og:image>cid:sha-256+e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855@bob.xmpp.org</og:image>
    <og:image>ni:///shai-256;47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU</og:image>
    <og:image>data:image/jpeg,...</og:image>
    <og:video>https://videos.example.com/video-embed.html</og:video>
    <og:type>website</og:type>
    <og:site_name>Example Website</og:site_name>
  </rdf:Description>
</message>]]></example>
  </section2>
</section1>
<section1 topic="Accessibility Considerations" anchor="access">
  <p>Depends on the metadata, but in general all metadata should be considered to create a UX that is accesibile (eg: not showing only the image).</p>
</section1>
<section1 topic="Internationalization Considerations" anchor="i18n">
  <p>Metadata will often be in the same language as the resource being described. If metadata in multiple languages is available, and implemenation MAY inject both in separate <tt>&lt;Description&gt;</tt> with the same <tt>about</tt> and differing <tt>xml:lang</tt>.</p>
</section1>
<section1 topic="Security Considerations" anchor="security">
  <p>Resolving, fetching, or interpreting remote resources may be fraught with security issues. Care should be taken to fetch and interpret a limited amount of data in a safe and structured way if necessary to produce the metadata.</p>
</section1>
<section1 topic="Privacy Considerations" anchor="privacy">
  <p>Fetching a remote resource may reveal interest on the part of an IP address, similar to clicking on a link. Recipients should not fetch remote resources of any kind without user intervention. Senders should be aware that generating this metadata may confer the same privacy result as opening the link they are sending.</p>
</section1>
<section1 topic="IANA Considerations" anchor="iana">
  <p>None.</p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <p>None.</p>
</section1>
</xep>
