datopian / flowershow

💐 Publish your obsidian digital garden or any markdown site easily and elegantly.
https://flowershow.app/
MIT License
752 stars 93 forks source link

Backlinks #29

Open rufuspollock opened 2 years ago

rufuspollock commented 2 years ago

Show backlinks for a page (optional / configurable). Backlinks are all the pages that link to this page.

meherhowji commented 1 year ago

This will enhance the user experience greatly as this is a common denominator to all PKM apps.

rufuspollock commented 1 year ago

@meherranjan we have the core work for this implemented in the backend. Where would you want this displayed on the frontend exactly? On the network map or where? cf #37

meherhowji commented 1 year ago

@rufuspollock In my experience, from the webpage point of view backlinks at the bottom/sidebar of the article can be more valuable in driving the overall engagement. Graph maps can be a wow factor.

meherhowji commented 1 year ago

@rufuspollock by the way I was able to get backlinks working for me on my site, it still needs catching edge cases but the main idea is as simple as this:

function getBacklinks(slug) {
  const backlinkList = allPosts.filter(doc => doc.body.raw.includes('[[' + slug))
  return backlinkList.map(({ title, slug }) => ({ title, slug }))
}
// consume the function in the getstaticprops and pass it your component along with the post data

Post with backlinks: https://meherhowji-com-git-contentlayer-meherranjan.vercel.app/default-binding-this-keyword Main website URL: https://meherhowji.com

I am yet to merge this feature branch to master hence the URL is auto-generated by Vercel.

Maybe this idea could be extended to render a network graph on the client side too. Honestly I plan to the consume the package you will publish as it seems to be one of your top Todos. 😃

rufuspollock commented 1 year ago

@meherranjan this is great. 👏