diff --git a/src/helpers/filetreeUtils.js b/src/helpers/filetreeUtils.js index abe3306..707787b 100644 --- a/src/helpers/filetreeUtils.js +++ b/src/helpers/filetreeUtils.js @@ -77,8 +77,8 @@ function getPermalinkMeta(note, key) { if (note.data.hide) { hide = note.data.hide; } - if (frontMatter.data.pinned) { - pinned = frontMatter.data.pinned; + if (note.data.pinned) { + pinned = note.data.pinned; } if (note.data["dg-path"]) { folders = note.data["dg-path"].split("/"); diff --git a/src/helpers/linkUtils.js b/src/helpers/linkUtils.js index e8655cc..aabcc17 100644 --- a/src/helpers/linkUtils.js +++ b/src/helpers/linkUtils.js @@ -57,6 +57,7 @@ function getGraph(data) { neighbors: new Set(), backLinks: new Set(), noteIcon: v.data.noteIcon || process.env.NOTE_ICON_DEFAULT, + hide: v.data.hideInGraph || false, }; stemURLs[fpath] = v.url; if ( diff --git a/src/site/_includes/components/graphScript.njk b/src/site/_includes/components/graphScript.njk index 7e2d41b..e97f805 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]; } @@ -164,9 +166,10 @@ window.fullGraph = null; function renderFullGraph() { if (!window.fullGraph) { + const hiddens = Object.values(window.graphData.nodes).filter((n) => n.hide).map((n) => n.id); const graphData = { - links: JSON.parse(JSON.stringify(window.graphData.links)), - nodes: [...Object.values(window.graphData.nodes)] + links: JSON.parse(JSON.stringify(window.graphData.links)).filter((l) => hiddens.indexOf(l.source) == -1 && hiddens.indexOf(l.target) == -1), + nodes: [...Object.values(window.graphData.nodes).filter((n) => !n.hide)] } let g = document.createElement('div');