Skip to content

Commit

Permalink
bugfix: backlinks should be unique
Browse files Browse the repository at this point in the history
  • Loading branch information
carbontwelve committed May 4, 2024
1 parent 0216401 commit c173f77
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/interlinker.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ module.exports = class Interlinker {
page.data.backlinks = [];
}

page.data.backlinks.push({
url: currentPage.url,
title: currentPage.data.title,
});
if (page.data.backlinks.findIndex((backlink => backlink.url === currentPage.url)) === -1) {
page.data.backlinks.push({
url: currentPage.url,
title: currentPage.data.title,
});
}

// If this is an embed and the embed template hasn't been compiled, add this to the queue
// @TODO compiledEmbeds should be keyed by the wikilink text as i'll be allowing setting embed values via namespace, or other method e.g ![[ident||template]]
Expand Down

0 comments on commit c173f77

Please sign in to comment.