mod_ogp/README.markdown
author JC Brand <jc@opkode.com>
Mon, 22 Feb 2021 17:51:51 +0100
changeset 4464 205e50fdcebc
child 4487 c4f11a4b5ac7
permissions -rw-r--r--
mod_ogp: Add README
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4464
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
     1
# mod_ogp
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
     2
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
     3
This module adds [Open Graph Protocol](https://ogp.me) metadata to URLs sent inside a MUC.
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
     4
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
     5
With mod_ogp enabled, when a user sends a URL in a MUC (where the message has its `id` equal to its `origin-id`), the module calls the URL and parses the result for `<meta>` html tags that have any `og:...` properties.
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
     6
If it finds any, it sends a [XEP-0422 fastening](https://xmpp.org/extensions/xep-0422.html) applied to the original message that looks like:
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
     7
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
     8
```
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
     9
    <message id="example" from="chatroom@chatservice.example" to="chatroom@chatservice.example">
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
    10
        <apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-X">
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
    11
            <meta xmlns="http://www.w3.org/1999/xhtml" property="og:title" content="The Rock"/>
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
    12
            <meta xmlns="http://www.w3.org/1999/xhtml" property="og:url" content="https://www.imdb.com/title/tt0117500/"/>
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
    13
            <meta xmlns="http://www.w3.org/1999/xhtml" property="og:image" content="https://ia.media-imdb.com/images/rock.jpg"/>
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
    14
        </apply-to>
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
    15
    </message>
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
    16
```
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
    17
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
    18
The module is intentionally simple in the sense that it is basically a transport for https://ogp.me/