I’d like to implement backlinks on this site, but I’m not sure how. My site is built with Sveltkit & mdsvex (like MDX but in Svelte).
A backlink is a concept popularized by Roam & Obsidian. It’s a markdown syntax that looks like this:
All instances of
[[another-link]] should materialize as a special post that lists all the references to it.
It seems lik the steps to implement this are:
- make sure mdsvex can preprocess the double-bracket syntax and generate a link to a route like
/backlinksif the backlink does not exist as a post, otherwise the title to the post as a link.
- all posts should have a “referred by” section at the end showing any backlinks to it.
- There should be a
/backlinksroute for non-posts that collects all of the backlink posts and displays them. If a post gets made, this backlink route should transform to the post itself.
On first glance, it seems that a remark plugin would take care of this.
But my friend Will Lachance also suggests that mdsvex 1.0 is going to move away from remark entirely, into a new exciting future with generic directives and shortcodes-by-default. I’m happy to wait for that future and work on other things in the meantime (or contribute to the development of that future).
Some GH discussions on this migration:
- #293 Penguin-flavoured markdown – markdown syntax changes. Includes discussion of generic directives.
- #259 early feedback for v1 – discussion around starting fresh w/ the plugin ecosystem, presets, etc. – well worth the read.
Thanks for reading. Free free to reach out to me on Twitter w/ questions and disagreements.