crisrojas / Zettels

Zettels Hugo Theme
108 stars 14 forks source link

Add support for nested linking and print filename of link #3

Closed hedonhermdev closed 3 years ago

hedonhermdev commented 3 years ago

Made some changes to the regex so that nested wikilinks like [[apple/pen]] work too along with the backlinks.

Also kind of changed the way links are rendered so let me know if you want me to remove that change.

crisrojas commented 3 years ago

Hi @hedonhermdev 👋,

First of all thanks a lot for contributing. I've not had much time lately to test your code. I will take a look as soon as posible (it will be fast, I promise 🙂)

By the way, what motivated you to change the links 🙂?

crisrojas commented 3 years ago

Hi @hedonhermdev,

It seems that the changes you added break the links rendering and also delete the button that allows previewing a note in a side panel (see split view)

Links are being rendered in an inconsistent way:

 2021-04-30 at 14 05 44

Therefore I can't merge the PR as it is.

Also, in a zettelkasten archive all your notes are supposed to be in the same root folder and note links should be a reference to the note identifier itself. By adding slash support to the regex you basically get a regular markdown link, which misses the point of wikilinks.

If one still wants use folders because of organization reasons there's actually a simpler approach that I consider to work nicely (is the one I'm using for my personal site), in your hugo config.toml file:

[permalinks]
    folder1 = "/notes/:filename"
    folder2 = "/notes/:filename"

This way notes in both folders are rendered in the same directory, and you can link notes in folder1 from notes of folder2 (and viceversa) with a regular [[wikilink]].

So I don't think there is really a need for this feature, thererfore I'm closing the PR.