A tool to send webmentions from a static website.
The information below may be outdated. For the latest version, check the repository.
a tool to send webmentions from a static website
Table of Contents
static-webmentions get better!
This tool allows you to do just that, and with some effort you can even automate your outgoing webmentions.
static-webmentions works is by comparing two versions of a static site (residing in two separate directories), figuring out what new webmentions are to be sent, and, eventually, sending them. Thus, you need to make sure that at some point of your publishing process you have two directories: one with the old state of your site, and one with the new state. Given that you have
static-webmentions configured correctly, at this point you can:
to find out which webmentions are to be sent and save them to a temporary file, and then, when the new content is online and alive,
to read the pending webmentions from the temporary file and send them out.
If your publishing process is set up so that at the moment when you have the two versions the new version is already published, you can do both steps in one go:
static-webmention will detect new and changed pages, and send webmentions as appropriate. To have deleted pages processed correctly, the new state of the site should have tombstones containing a
<meta http-equiv="Status" content="410 Gone" /> tag in place of the removed pages.
static-webmentions will look for a config file (
config.toml in current directory by default). An example config file with all the supported options is included, all the options are fairly self-explanatory. Hugo users may want to use the same
config.toml that they store their website configuration in.
Several command-line flags can be used to override the options specified in the config file:
the config file to read config from. Default is
config.toml in current working directory.
base URL of the site (i.e.
the file to store pending webmentions to, or to read them from if
send command is given. If no file is specified,
static-webmentions find will just print out the list of webmentions it found.
the directories where old and new versions of the site are located.
Depending on your publishing process, automating your outgoing webmentions may require different steps. Here’s an example how I do it for my own website.
The website is built using Hugo, the source is stored in a Git repository. I put both
static-webmentions binaries on the hosting server, and can publish a new version of the site with a simple script:
The actual script I use is more complex and the actual process is more error-proof, the script above is a minimal working example.
Pull requests are always welcome!
This software includes the following software or parts thereof:
- willnorris/webmention Copyright 2014, Google Inc. All rights reserved.
- goquery Copyright © 2012-2016, Martin Angers & Contributors
- BurntSushi/toml Copyright © 2013 TOML authors
- udhos/equalfile Copyright © 2016 udhos
- go-cmp Copyright © 2017 The Go Authors. All rights reserved.
- cascadia Copyright © 2011 Andy Balholm. All rights reserved.
- wsxiaoys/terminal Copyright © 2013 Meng Zhang. All rights reserved.
- The Go Programming Language Copyright © 2009 The Go Authors