Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support wiki-style internal page links #2104

Open
heitorPB opened this issue Feb 16, 2023 · 4 comments
Open

Support wiki-style internal page links #2104

heitorPB opened this issue Feb 16, 2023 · 4 comments

Comments

@heitorPB
Copy link
Contributor

It would be great for Zola to support wiki-style page links (a.k.a. wikilinks).

Wiki-links are in the format [[Foo Bar]] that translates to [Foo Bar](path/foo-bar) and [[Foo Bar|Custom Title]] that translates to [Custom Title](path/foo-bar). Those links are for internal pages only.

This format is used in:

I know Zola has its own format for that (which is much more comfortable to use than what I saw on other systems), but Wiki links are gaining a lot of popularity. Supporting that would make the transition from other systems to Zola easier (my particular use case) and would add good tooling support to editing Zola-powered websites (in Vim/Neovim, hitting on a markdown/wiki link opens that document).

This was requested on the Forums but it was dismissed without discussion. There was another forum post that mentions the lack of support for wikilinks.

@c-git
Copy link
Contributor

c-git commented Feb 17, 2023

The maintainer did respond and say it wouldn't be supported on the first request that you mentioned. But if I may add my 2 cents. There are already 2 ways to add links in Common Mark which is what Zola uses. I am all for options but too many options can lead to confusion, make the project more difficult to maintain and actually lead to a "less good" product in the end.

I'm of the opinion that you can add a "preprocessor" before you call zola that would convert the "wiki links" to one of the options supported in common mark. I'm happy to give a try at helping with the preprocessor if that is an option you think would meet your needs.

A general sketch of what I'm thinking is you have this program that will run through the content folder and look for a regex that matches the format and the use a capture group to get the info and the replace it in place by editing the file. (Maybe backing it up first?)

@Keats
Copy link
Collaborator

Keats commented Feb 17, 2023

Yeah as mentioned by @c-git we already added a way to add link that is not in CommonMark. Adding another way to do the same thing but less powerful/obvious is not going to happen.

How would you link to the following files with Wiki links for example:

  • content/blog/2022-01-01_index.md
  • content/wiki/_index.md
  • content/wiki/colocated/index.md

@heitorPB
Copy link
Contributor Author

I agree with you to avoid feature creep. That can easily add a huge burden on the dev team. Adding features that are not exactly new should be decided with care. That's why I started this issue: to have this discussion :)

I'm of the opinion that you can add a "preprocessor" before you call zola that would convert the "wiki links" to one of the options supported in common mark

I'm currently using this strategy. I have a Perl script that "translates" wiki links. But as my internal wiki grew, this script is now taking ~10s to parse all my ~2k pages. This is getting too annoying for me.

As for pages with same title, but in different places, I have something like this in my Ultimate Index page:

  • [[diary/index|Diary entries]] -> [Diary Entries](diary/index.html)
  • [[wiki/index]] -> [Index](wiki/index.html)
  • [[wiki/work/index]] -> [Index](wiki/work/index.html)

In the wikilink format you can specify a path to the file to solve any ambiguity.

@c-git
Copy link
Contributor

c-git commented Feb 17, 2023

I'd add a small db to check last modified time to avoid processing files that have already been processed and that should cut down the runtime substantially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants