Making a wiki with vimWiki

I read through:

and the Hugo docs to try and figure out how to link .md Vimwiki documents together but I couldn’t seem to figure it out. In the wiki the files are linked to in any of the following ways…

  • [[name of wiki page]]
  • [name of link](name of wiki page)
  • [name of link](name of wiki page.md)

when I tried to replicate this cristianpb’s sh file for automating the process didn’t seem to work (I think he had some files that he doesn’t include) so I put the wiki files in the content folder under /posts/. However, the links would not work and only the wiki index page would render. If anyone has experience with this or some advice please let me know!

I have read the cristianpb’s post and I agree that there is a lack of information to understand the integration that he made with Hugo.

Perhaps the author of the post can give you a better answer: https://twitter.com/cris_perez_b

Thank you for responding,

I saw that he has contact info but was unsure if he would be open to random people emailing / reaching out. I will give it a try !

1 Like

Hello,

Markdown files should be placed in the content folder. All files in this folder are converted into html on the public folder when using the command hugo --config config.toml.

You can try to clone the project and use hugo --config config.toml to see if you obtain the same behaviour. Otherwise that would help me to see why it doesn’t work.

In order to get vimwiki working with hugo, you should add the configuration to vimrc file like here and be sure to have wiki2html.sh file.

1 Like

@CadeMichael, here is the answer from the author of the post you mentioned. :+1:

@cristianpb, thank you for taking the time to respond. :slightly_smiling_face:

thank you for your response!

I had a similar config and placed everything in the content folder (in the post subclass I believe) the main issue that I experienced was that the links were not working. So one content page would not link to the other. The only one that would render is the home page of the wiki, and all links on it were to 404. I half solved the issue by just using the vim wiki syntax and converting to html with their converter and hosting the pages as an extension of my website, which of course isn’t ideal (the formatting is very different from the main website) but works.

I’d like to join in to hammer out a real working solution to this problem. While I appreciate the input of cristianpb, and I do not doubt that he has made these tools work together for his own purposes, he simply has not given all the details of how to get a working solution.

The first thought that comes to mind for me, and what I’m trying to accomplish, is to start analyzing a working site to better understand how Hugo does what it does with Markdown files. I’ve managed to put together a local repo of the Docsy User Guide (which is smaller than the docsy-example site). I’ve then removed support for multiple languages from the config.toml file, and I plan to gradually remove any other stuff that turns out not to be necessary, so that I end up with a working site which has minimal configuration. That way I’ve got a better chance at wrapping my head around the problem at hand.

The first thing that I see I will have to reconcile is Hugo’s use of index.md/_index.md versus VimWiki’s use of wiki.md (when you tell VimWiki to use Markdown syntax, which seems to me the path of least resistance).

Please, anyone who would like to join in and help us really get this working, feel free to do so. Once I have worked things out in my own wiki, I’ll publish a Hugo site with comprehensive instructions that anyone can follow, but of course at this time I don’t know what the hell I’m doing yet.

I cant remember where I found this snippet, but this is all I needed to add into the following file:
~/layouts/vimwiki/_markup/render-link.html

<a href="{{ .Destination }}" {{ with .Title }} title="{{ . }}"{{ end }} {{ if strings.HasPrefix .Destination "https" }} target="_blank"{{ end }}>{{ .Text }}</a>

1 Like

Ah, very interesting, pinchedave. I will certainly investigate this snippet and report back here as to what it does for me at my earliest opportunity.

That may not be real soon, as my personal life is in a state of upheaval at the moment. Nonetheless, I intend to follow up because I am not going to abandon Vimwiki and Hugo seems like the right tool for the job.

Stay tuned, and anyone who has more specific information, please share!

1 Like

hi all.

Any development on how to get a working solution?
Kind regards

The reasons for this, AKAIK, come from christianpb theme vimwiki.
In the theme he has a setup where most of the pages are auto generated from the homepage. This is at least how it seems to me, because like so many others here I’ve noted that there is no documentation that follows the theme that christianbp has uploaded to github. Instead that leaves others grappling with what it is he is sharing.

From what I can tell reviewing his hugo theme is that the links are populated automatically from the base of the content dir. This is problem for me because I intended to use the theme to link submodules I’ve been working on because that is how I organize my vimwiki. So while he has links that are lateral they don’t scale recursively.
Here is the index.html

{{ define "main" }}
{{ .Content }}
{{- partial "posts.html" . -}}
{{ end }}

and here is the partials/posts.html

{{ .Title }}

{{- .Content -}}

<h3>Sections</h3>

{{ range site.Sections }}
    <li>
        <a href="{{ .Permalink }}">
            {{- .Section -}}
            <small><time>{{ .FuzzyWordCount }}</time></small>
        </a>
    </li>
{{ end }}

<h3>Pages</h3>
<ul>
{{ range where .Pages ".File.BaseFileName" "!=" "index" }}
    <li>
        <a href="{{ .Permalink }}">
          {{ with .Title }}
          {{ . }}
          {{ else }}
          {{ .File.BaseFileName }}
          {{ end }}
        </a>
    </li>
{{ end }}
</ul>

my hugo is a little shaky at this point because there are weeks where I don’t really touch the language, but I know that this variable .Pages has something to do with which pages are populated in the ‘index.html’.
So what immediately comes to mind, at least in my case where the population needs occur recursively is to change it to the bundle page version which I can;t recall off the top of my head.
Oops, maybe I’m thinking backwards… like it needs to be ‘Pages.Permalink’ or something