@chrisburnell/eleventy-cache-webmentions 0.1.4 → 0.1.8

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 CHANGED
@@ -1,4 +1,4 @@
1
- # eleventy-cache-assets
1
+ # eleventy-cache-webmentions
2
2
 
3
3
  > Cache webmentions using eleventy-cache-assets and make them available to use in collections, templates, pages, etc.
4
4
 
@@ -5,6 +5,7 @@ const { AssetCache } = require("@11ty/eleventy-cache-assets")
5
5
 
6
6
  // Load .env variables with dotenv
7
7
  require("dotenv").config()
8
+
8
9
  const TOKEN = process.env.WEBMENTION_IO_TOKEN
9
10
 
10
11
  const absoluteURL = (url, domain) => {
@@ -41,7 +42,7 @@ const epoch = (value) => {
41
42
  return new Date(value).getTime()
42
43
  }
43
44
 
44
- module.exports = (, options = {}) => {
45
+ module.exports = (eleventyConfig, options = {}) => {
45
46
  options = Object.assign(
46
47
  {
47
48
  duration: "23h",
@@ -93,7 +94,7 @@ module.exports = (, options = {}) => {
93
94
  return Promise.reject(response)
94
95
  })
95
96
  .catch((error) => {
96
- console.log("[${hostname(options.domain)}] Something went wrong with your request to webmention.io!", error)
97
+ console.log(`[${hostname(options.domain)}] Something went wrong with your request to webmention.io!`, error)
97
98
  })
98
99
  }
99
100
 
@@ -181,9 +182,14 @@ module.exports = (, options = {}) => {
181
182
  throw new Error("domain is a required option to be passed when adding the plugin to your eleventyConfig using addPlugin.")
182
183
  }
183
184
 
185
+ // Liquid/Nunjucks Filters
184
186
  eleventyConfig.addLiquidFilter("getWebmentions", getWebmentionsFilter)
185
187
  eleventyConfig.addNunjucksAsyncFilter("getWebmentions", getWebmentionsFilter)
188
+
189
+ // Eleventy Data
190
+ eleventyConfig.addGlobalData("webmentions", filteredWebmentions)
186
191
  } else {
192
+ // JavaScript
187
193
  return filteredWebmentions
188
194
  }
189
195
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisburnell/eleventy-cache-webmentions",
3
- "version": "0.1.4",
3
+ "version": "0.1.8",
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>",
@@ -23,6 +23,9 @@
23
23
  "sanitize-html": "^2.5.2"
24
24
  },
25
25
  "keywords": [
26
- "eleventy"
26
+ "eleventy",
27
+ "eleventy-plugin",
28
+ "indieweb",
29
+ "webmention"
27
30
  ]
28
31
  }