Home

Awesome

webmention.js

Client-side library for rendering webmentions from webmention.io

Usage

  1. Copy the JavaScript file (webmention.min.js) from the static/ directory to somewhere on your website

  2. Put a <div id="webmentions"></div> where you want your webmentions to be embedded

  3. Put a <script src="/path/to/webmention.min.js" async></script> somewhere on your page (typically inside <head> but it doesn't really matter), replacing /path/to/ with whatever directory the JavaScript file is in

  4. You'll probably want to add some CSS rules to your stylesheet, in particular:

    #webmentions img { max-height: 1.2em; margin-right: -1ex; }

    See the included webmention.css file for an example.

You can also pass in some arguments, for example:

<script src="/path/to/webmention.min.js" data-id="webmention-container" async></script>

Note that the async isn't strictly necessary but it can speed up apparent page loads.

Accepted arguments (see the source in static/webmention.js for more details):

Look at the source code itself for more detailed information.

Localization/Internationalization

This library supports i18next to provide translations into other languages. The following strings are supported:

keyusage
repliedreact image hover title
likedreact image hover title
repostedreact image hover title
reactedreact image hover title
bookmarkedreact image hover title
mentionedreact image hover title
RSVPedreact image hover title
followedreact image hover title
ResponsesHeadline for comments
mentionformatted comment
ReactionsHeadline for reactions

Development

To produce a minified JS, first install Node dependencies (via npm install) and then run npm run minify.

Contributors

Listed in order of first contribution: