[SOLVED] List templates not working

Hi folks, I’ve been banging my head against my keyboard all night trying to get list templates to work for a site I’m working on. I am still not having any luck figuring it out, so I need some help.
Would someone be able to have a look at my repo for me and let me know if they can see what I’m doing wrong?


Thanks
—Luke

For a list page, most of the time you’ll want to iterate through the content of a certain type (i.e. all the files in your /content/post folder).

So somewhere in your_default/list.html template you’ll want to use the range operator to do this.

Here’s a simple example

Hey Dan, thanks for the response.
The current list page is intentionally super simple for the time being just so I can test if the page will load at all.
Currently when I go to http://localhost:1313/post/ when I’m running the Hugo server, I get a blank page.

<html><head></head><body><pre></pre>
</body></html>

what about http://localhost:1313/posts/?

Tried that, doesn’t seem to work either.

404 page not found

Doesn’t even generate any HTML

If I build the site, here is the output tree:

├── 404.html
├── about
│   └── index.html
├── categories
│   └── index.html
├── css
│   └── styles.min.2febf7dd3df0616ca60e090763d49433e5008acaa82884918399631670f093ee.css
├── img
│   ├── 2018-09-16
│   │   ├── 1.jpg
│   │   ├── 2.jpg
│   │   ├── 3.jpg
│   │   ├── 4.jpg
│   │   ├── 5.jpg
│   │   ├── 6.jpg
│   │   ├── 7.jpg
│   │   ├── 8.jpg
│   │   └── 9.jpg
│   ├── apple-touch-icon-180x180.png
│   ├── favicon.png
│   └── logo.png
├── index.html
├── post
│   ├── 1
│   │   └── index.html
│   └── 2
│       └── index.html
└── tags
    └── index.html

9 directories, 20 files

In your config.toml you have

disableKinds      = ["section", "RSS", "sitemap", "robotsTXT"]

From the docs: https://gohugo.io/getting-started/configuration/#all-configuration-settings

disableKinds ([])
Enable disabling of all pages of the specified Kinds . Allowed values in this list: "page" , "home" , "section" , "taxonomy" , "taxonomyTerm" , "RSS" , "sitemap" , "robotsTXT" , "404" .

So this is disabling the generation of the section kind: https://gohugo.io/templates/section-templates/#page-kinds which is what /post/ is.

3 Likes

Thank you so!
I swear I tried that already, but just tried again and it worked!
Cheers @pointyfar beer🍻