Multiple static pages at root level?

Hello,

I’ve been struggling to get this super simple thing to work. I’m not sure if there’s a bug in my version of Hugo or if I’m doing something very wrong.

Basically, I want my website to be accessible by: http://URL, and this gives me the home page — this much is working, index.md is being used. However, whenever I try to implement other pages, like http://URL/projects, the markdown file is not parsed and not put inside the public folder.

This is the structure of my content folder:

- content
- - index.md
- - projects.md
- - resources.md

Inside the public folder, I have index.html, but nothing for the other two. Their headers follow this pattern:

---
author: Name Here
title: Projects
type: static
---

I also tried changing the type to single, and many other values, without success.
Disclaimer: I’ve read basically all related material online, including topics here about rendering multiple root level html pages, without success. None worked.

Version: Hugo Static Site Generator v0.53/extended darwin/amd64 BuildDate: unknown

Hi. You need to change content/index.md to _index.md. This will convert that directory level from a leaf bundle to a branch bundle, and allow your other pages to display

1 Like

Hi @zwbetz,

Thanks for the quick reply! :slight_smile:
I’ve tried doing this, but then when compiling I get this:
Error: Error building site: failed to render pages: render of "home" failed: "/PATH/site/themes/bootstrap/layouts/static/list.html:7:31": execute of template failed: template: static/list.html:7:31: executing "static/list.html" at <.Paginator.Pages>: undefined variable: $index

Hmm. This is a separate issue. We’d have to see your code to troubleshoot further

1 Like

If I change the type inside _index.md to single (it was static before), it works for all the pages, except index itself (home is inaccessible, there is an index.xml inside public, but no index.html).

Try totally removing that type line from front matter

1 Like

Managed to fix it by creating a file index.html inside layouts with this content:

{{ partial "head" . }}
<div class="container content">
  {{ .Content }}
</div>
{{ partial "foot" . }}

Now everything is working as intended.

Thank you a lot, @zwbetz. I had spent a lot of time on this without success. :smiley:

Ah yes, you need a homepage template :slightly_smiling_face: this is why I asked to see your code. Anyways glad you got it working

1 Like