@chrisburnell/eleventy-cache-webmentions 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/eleventy-cache-webmentions.js +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
- **With npm:** `npm install @chrisburnell/eleventy-cache-webmentions`
|
|
8
8
|
- **Direct download:** [https://github.com/chrisburnell/eleventy-cache-webmentions/archive/master.zip](https://github.com/chrisburnell/eleventy-cache-webmentions/archive/master.zip)
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Documentation
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
The full **eleventy-cache-webmentions** documentation can be found here: [chrisburnell.com/eleventy-cache-webmentions/](https://chrisburnell.com/eleventy-cache-webmentions/).
|
|
13
13
|
|
|
14
14
|
## Authors
|
|
15
15
|
|
|
@@ -45,7 +45,6 @@ const epoch = (value) => {
|
|
|
45
45
|
module.exports = (eleventyConfig, options = {}) => {
|
|
46
46
|
options = Object.assign(
|
|
47
47
|
{
|
|
48
|
-
duration: "23h",
|
|
49
48
|
key: "webmentions",
|
|
50
49
|
allowedHTML: {
|
|
51
50
|
allowedTags: ["b", "i", "em", "strong", "a"],
|
|
@@ -61,7 +60,7 @@ module.exports = (eleventyConfig, options = {}) => {
|
|
|
61
60
|
)
|
|
62
61
|
|
|
63
62
|
const fetchWebmentions = async () => {
|
|
64
|
-
let asset = new AssetCache(options.key)
|
|
63
|
+
let asset = new AssetCache(options.uniqueKey || options.key)
|
|
65
64
|
asset.ensureDir()
|
|
66
65
|
|
|
67
66
|
let webmentions = {
|
|
@@ -78,7 +77,7 @@ module.exports = (eleventyConfig, options = {}) => {
|
|
|
78
77
|
// If there is a cached file but it is outside of expiry, fetch fresh
|
|
79
78
|
// results since the most recent
|
|
80
79
|
if (!asset.isCacheValid(options.duration)) {
|
|
81
|
-
const since = asset._cache.getKey(options.key) ? asset._cache.getKey(options.key).cachedAt : false
|
|
80
|
+
const since = asset._cache.getKey(options.uniqueKey || options.key) ? asset._cache.getKey(options.uniqueKey || options.key).cachedAt : false
|
|
82
81
|
const url = `https://webmention.io/api/mentions.jf2?domain=${hostname(options.domain)}&token=${TOKEN}&per-page=9001${since ? `&since=${since}` : ``}`
|
|
83
82
|
await fetch(url)
|
|
84
83
|
.then(async (response) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrisburnell/eleventy-cache-webmentions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Cache webmentions from webmention.io using eleventy-cache-assets.",
|
|
5
5
|
"main": "eleventy-cache-webmentions.js",
|
|
6
6
|
"author": "Chris Burnell <me@chrisburnell.com>",
|