Open jordan-thirus opened 2 months ago
I used patch-package to patch eleventy-plugin-backlinks@0.2.1
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/eleventy-plugin-backlinks/lib/get-backlinks.js b/node_modules/eleventy-plugin-backlinks/lib/get-backlinks.js
index 87b0c18..3a9a814 100644
--- a/node_modules/eleventy-plugin-backlinks/lib/get-backlinks.js
+++ b/node_modules/eleventy-plugin-backlinks/lib/get-backlinks.js
@@ -6,7 +6,7 @@ function caselessCompare(a, b) {
const wikilinkRegExp = /\[\[\s*([^\[\]\|\n\r]+)(\|[^\[\]\|\n\r]+)?\s*\]\]/g
module.exports = function (options) {
- return ({ collections, page }) => {
+ return async ({ collections, page }) => {
const { notes } = collections;
const fileStem = page.filePathStem.replace(`/${options.folder}/`, '');
@@ -15,7 +15,7 @@ module.exports = function (options) {
// Search the other notes for backlinks
for (const otherNote of notes) {
- const noteContent = otherNote.template.frontMatter.content;
+ const noteContent = (await otherNote.template.read()).content;
// Get all links from otherNote
const outboundLinks = (noteContent.match(wikilinkRegExp) || [])
This issue body was partially generated by patch-package.
I wanted to try upgrading to 3.0.0 which required forcing the install of this plugin to see if it was possible. This plugin fails with the error following error
I believe what needs to happen is that the link in
get-backlinks.js
needs to use(await otherNote.template.read())
instead of accessing the frontmatter directly.