- Add title back to Backlink

- Remove duplicated backlink and self-reference.
This commit is contained in:
Tuan Cao 2022-04-18 12:02:05 +07:00
parent ce8de2da9f
commit 758a8c90b4
2 changed files with 3 additions and 2 deletions

View File

@ -100,6 +100,7 @@ export function constructGraphData() {
.forEach(aFilePath => { .forEach(aFilePath => {
// const {currentFilePath} = getFileNames(filename) // const {currentFilePath} = getFileNames(filename)
const aNode = { const aNode = {
title: Transformer.parseFileNameFromPath(aFilePath),
slug: toSlug(aFilePath), slug: toSlug(aFilePath),
shortSummary: getShortSummary(toSlug(aFilePath)) shortSummary: getShortSummary(toSlug(aFilePath))
} }

View File

@ -55,14 +55,14 @@ export function getStaticProps({params}) {
const listOfEdges = edges.filter(anEdge => anEdge.target === params.id) const listOfEdges = edges.filter(anEdge => anEdge.target === params.id)
const internalLinks = listOfEdges.map(anEdge => nodes.find(aNode => aNode.slug === anEdge.source)).filter(element => element !== undefined) const internalLinks = listOfEdges.map(anEdge => nodes.find(aNode => aNode.slug === anEdge.source)).filter(element => element !== undefined)
const backLinks = [...new Set(internalLinks)]
const graphData = getLocalGraphData(params.id) const graphData = getLocalGraphData(params.id)
return { return {
props: { props: {
note, note,
tree: tree, tree: tree,
flattenNodes: flattenNodes, flattenNodes: flattenNodes,
backLinks: internalLinks, backLinks: backLinks.filter(link => link.slug !== params.id),
graphData: graphData graphData: graphData
}, },
}; };