I have a folder ~/dox/notes
full of .md files. I want to render them all with Hugo.
First of all, i created a folder ~/dox/notes/test
with config.toml
file (and the rest files created by hugo new site
), containing:
baseURL = 'http://localhost:12000/'
languageCode = 'en-us'
title = 'Zettelkasten'
And if i try to run
hugo --contentDir ~/dox/notes --configDir ~/dox/notes/test serve --port 12000
, the server says Page not found on any page including the /.
But that seems to be caused by the following issue, so later on that.
I copied all the markdowns to the contents/
folder just to be sure, and the same thing happened.
I googled a bit and found that i need to create layouts/_default/single.html
file. So i created it and put {{ .Content }}
in there, and then my index.md
file appeared on http://localhost:12000/
as expected. But then i noticed that the links are incorrect, being in form of [foo](foo.md)
in source, and also having .md
extension in rendered hrefs, which is not how Hugo names pages. Another bit (a chunk) of googling led me to layout/_default/_markup/render-link.md
containing <a href="{{ replace .Destination ".md" "" | safeURL }}">{{ .Text | safeHTML }}</a>
, which is hacky but at least it works (for rewriting links at least).
But then when i tried to go to the links they all have Page not found error. And google says that it is the way Hugo works, rendering content/foo.md as http://localhost:12000/foo/
.
And yes, it does output warnings:
WARN 2023/03/07 17:41:40 found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts
Lookup Rules for this combination.
WARN 2023/03/07 17:41:40 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Lay
outs Lookup Rules for this combination.
WARN 2023/03/07 17:41:40 found no layout file for "HTML" for kind "taxonomy": You should create a template file which matches Hugo Lay
outs Lookup Rules for this combination.
And the info:
-------------------+------
Pages | 188
Paginator pages | 0
Non-page files | 0
Static files | 0
Processed images | 0
Aliases | 0
Sitemaps | 1
Cleaned | 0
I’m too confused and tired by now. Can someone explain me what should i do if i just want to simply render every markdown file in specified folder (recursively), with links in form of [foo](foo.md)
or [bar](../bar.md)
, without any fancy templating or index page or taxonomy pages or yaml front matter nonsense?
And the general advice and tips on running a portable ZK of markdown files (meaning a folder that does not have anything about Hugo in it and preferably not even located in a Hugo project, but i can fix that with Docker if the --contentDir
flag wouldn’t work) with Hugo would also be nice.