diff --git a/src/helpers/linkUtils.js b/src/helpers/linkUtils.js index f2e4ccf..189de0c 100644 --- a/src/helpers/linkUtils.js +++ b/src/helpers/linkUtils.js @@ -35,7 +35,7 @@ function getGraph(data) { let links = []; let stemURLs = {}; let homeAlias = "/"; - (data.collections.note||[]).forEach((v, idx) => { + (data.collections.note || []).forEach((v, idx) => { let fpath = v.filePathStem.replace("/notes/", ""); let parts = fpath.split("/"); let group = "none"; @@ -47,14 +47,21 @@ function getGraph(data) { title: v.data.title || v.fileSlug, url: v.url, group, - home: v.data["dg-home"] || (v.data.tags && v.data.tags.indexOf("gardenEntry") > -1)|| false, + home: + v.data["dg-home"] || + (v.data.tags && v.data.tags.indexOf("gardenEntry") > -1) || + false, outBound: extractLinks(v.template.frontMatter.content), neighbors: new Set(), backLinks: new Set(), - noteIcon: v.data.noteIcon || process.env.NOTE_ICON_DEFAULT + noteIcon: v.data.noteIcon || process.env.NOTE_ICON_DEFAULT, + hide: v.data.hideInGraph || false, }; stemURLs[fpath] = v.url; - if (v.data["dg-home"] || (v.data.tags && v.data.tags.indexOf("gardenEntry") > -1)) { + if ( + v.data["dg-home"] || + (v.data.tags && v.data.tags.indexOf("gardenEntry") > -1) + ) { homeAlias = v.url; } }); diff --git a/src/site/_includes/components/graphScript.njk b/src/site/_includes/components/graphScript.njk index 7e2d41b..29718e3 100644 --- a/src/site/_includes/components/graphScript.njk +++ b/src/site/_includes/components/graphScript.njk @@ -12,7 +12,9 @@ const keys = Object.values(existing).map((n) => n.neighbors).flat(); const n_remaining = Object.keys(remaining).reduce((acc, key) => { if (keys.indexOf(key) != -1) { - existing[key] = remaining[key]; + if (!remaining[key].hide) { + existing[key] = remaining[key]; + } } else { acc[key] = remaining[key]; }