First time User: How to add content? How to add toplevel sites that aren't posts?

So, I’m familiar with web technology, as I’m a web dev. But I can’t seem to render an MD file with Hugo.

Using the newest hugo. Starting with -D in draft mode. I’m using my own theme (is that my problem?) that I forked from some minimal theme somewhere. Here’s what I’m able to do:

define a baseof template and single and list templates, have header and footer show up, the html head and title show up correctly. It works well, I even included SCSS.

Here’s what I’m unable to do and I’m seriously at my wit’s end:

Have content show up. At all. My baseof looks like this:

<!DOCTYPE html>
<html class="no-js">
    {{- partial "head.html" . -}}
    <body>
      <div class="grid-container">
        {{- partial "header.html" . -}}
        <div id="content">
        {{ block "main" . }}{{ end }}
        </div>
        {{- partial "footer.html" . -}}
      </div>
    </body>
</html>

Then both single and list are this:

{{ define "main" }}
{{end}}

Simple, right? head, header, footer, all work. Great. Now I’ve got a file called content/_index.md. Looks somewhat like this:

---
title: "foo"
draft: true
---
Bla

I start hugo server --buildDrafts and Sure enough, my CSS works, header and footer are there and it reads the bloody title from _index.md, so it’s <title>foo</title>. So here is question number one:

Where did the content go? There’s none.

And next I have a file called content/foobar.md. Looks pretty much like the _index.md file. BUT: it doesn’t show up at all. 404 wherever I go. Hugo picks it up on WRITE, at least it tells me, but I can’t seem to navigate to it. That’s the second question:

I just want to have toplevel files, not /post/foo/ or so. How do I do that?

I’ve read the docs. I’ve read a lot of the docs. But I’m apparently too stupid to puzzle it together. I’d actually have appreciated a simple overview of how to make a simple site like that with your own theme and all components exemplified and explained. I couldn’t find one; is there one?

It won’t be visible until you add {{ .Content }} within:

{{ define "main" }}

{{ end }}

I guess it should normally work like the way you did. But you can try some workarounds till someone with more knowledge answers:

  1. Try restarting Hugo server if you haven’t already.
  2. In the frontmatter of the file, add a parameter called url. It should look like: url: "/foo". That would force Hugo to make that as the page address.
  3. You can force it to use a layout by using layout: "foo" in the frontmatter and then, in your layouts/page/foo.html, make it look same as the single page template.

Hi @adimit,

Hugo only renders what you tell it to render. This means you need to tell it where to put your content:

{{ .Content }}

See the docs here.

Please have a read about how to manage your content organization in the docs here: https://gohugo.io/content-management/organization/

There is a list of excellent resources here: Recommended Reading Reference

I would also suggest searching in the forums as most of the time, questions have already been previously asked and answered.