I’m hoping I’ll be able to use Hugo to build a website that integrates existing markdown files, but the rendering is really inconsistent. I am hoping to drop my existing files into subdirectories and just have them rendered as-is, but Hugo seems to randomly decide one of them is a list instead of a single page.
For example, in my content directory I have:
content
├── authors
│ ├── author1.md
│ └── author2.md
└── books
└── book1.md
index.md
I have tried adding _index.md
files to both content/authors
and content/books
but the problem persisted. I’ve also tried with index.md
files, both in the subdirectories and as my homepage, and every possible combination thereof with no success. I once had everything render correctly, but on restarting the server, at least one of the authors was again using the list template. Sometimes both use the list template. But I can restart the server and have them change. Perhaps author1 used the list before, then author2 is, or maybe both. Then I reload and it switches again.
For testing I have very simple layout files:
layouts
├── _default
│ ├── baseof.html
│ ├── list.html
│ └── single.html
├── index.html
└── partials
├── head.html
└── nav.html
My list.html
{{ define "main" }}
<div id="main-container">
<h2 class="text-center">Title</h2>
{{ range .Pages }}
<p>This is a list</p>
{{ end }}
</div>
{{ end }}
And my single.html
{{ define "main" }}
<div id="main-container">
{{ .Content }}
</div>
{{ end }}
My test files are also very simple, with no head matter, but I’m not referencing the head matter so I assume that shouldn’t matter. author1 for example:
# Author1
# Biography
They did something.
# Bibliography
* [Book 1](/books/book1)
I’m assuming I’m just not understanding bundles, but having read the page I had assumed adding _index.md
to the sub-directory would solve it, but it did not. Hence why I then tried every combination thereafter.
I realise I don’t need hugo for this small sample, but I am hoping to expand and build on it from here ,which is why I’m hoping to get this to work. Is this something that can be easily achieved?