YAVS

This site is built on piece of software called Hugo. I started using it because I was in a bit of a Go phase, messing around with it to learn the syntax and see it’s quirks. Go is neat. Hugo is neat. It actually makes writing up nice looking pages pretty quick.

However…

I have one major complaint so far. Somewhere in nice BOLD letters it needs to be explained that despite all of the nice people on the forums telling you that you can put whatever you want wherever you want in the content folder are LIARS.

It took far too long and far too much scrolling through people having the exact same issue but being told that they didn’t post enough information to find out that the issue is in fact where what files are and what they are named.

This may only apply to those using the hugo-bearblog theme (which is great btw), but if you have the following directory:

content\
+ _index.md
+ posts\
--+ index.md
--+ thing2.md
--+ thing3.md

For some insane reason, without divulging any errors or information, hugo WILL NOT render ANYTHING except for index.md from the posts folder. If you have this setup instead:

content\
+ _index.md
+ posts\
--+ _index.md (note the _)
--+ thing2.md
--+ thing3.md

It will render all of the posts inside the post folder, BUT it will not render any of the content actually in index.md. I’m sure this is by design and I understand the logic and reasoning behind it, BUT WHY IN THE EVER-LOVING F#$% would you not display errors that cause 60% of a site to just not render.

No like really, this is the output when it doesn’t render most of my pages:

void-sh nw-site  ➜ (master)  ♥ 18:16  hugo
Start building sites …
hugo v0.129.0-e85be29867d71e09ce48d293ad9d1f715bc09bb9+extended windows/amd64 BuildDate=2024-07-17T13:29:16Z VendorInfo=gohugoio


                   | EN
-------------------+-----
  Pages            | 12
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  1
  Processed images |  0
  Aliases          |  0
  Cleaned          |  0

and here’s what it looks like when it renders all the pages I want:

Start building sites …
hugo v0.129.0-e85be29867d71e09ce48d293ad9d1f715bc09bb9+extended windows/amd64 BuildDate=2024-07-17T13:29:16Z VendorInfo=gohugoio


                   | EN
-------------------+-----
  Pages            | 12
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  1
  Processed images |  0
  Aliases          |  0
  Cleaned          |  0

Please tell me where to find useful build info? Oh I know let’s turn on verbose logging, maybe the errors are just getting suppressed.

Start building sites …
hugo v0.129.0-e85be29867d71e09ce48d293ad9d1f715bc09bb9+extended windows/amd64 BuildDate=2024-07-17T13:29:16Z VendorInfo=gohugoio

INFO  static: syncing static files to \ duration 3.6127ms
INFO  build:  step process substep collect files 8 files_total 8 pages_total 3 resources_total 5 duration 2.6548ms
INFO  build:  step process duration 3.7032ms
INFO  build:  step assemble duration 522µs
INFO  build:  step render substep pages site en outputFormat html duration 18.3447ms
INFO  build:  step render substep pages site en outputFormat rss duration 2.81ms
INFO  build:  step render pages 7 content 4 duration 22.8492ms
INFO  build:  step render deferred count 0 duration 0s
INFO  build:  step postProcess duration 0s
INFO  build:  duration 30.7772ms

                   | EN
-------------------+-----
  Pages            | 12
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  1
  Processed images |  0
  Aliases          |  0
  Cleaned          |  0

Wow, that looks… exactly the fucking same. thanks Hugo.

Solution

So here’s the secret. As I said before this may just be specific to the theme I’m using, but it’s infuriatingly stupid nonetheless. To fix it, rename your posts\index.md to posts.md and put it in the same level as the posts folder. This will actually render your custom list/index page and render all of the sub-pages in the posts folder. This is what the example should look like:

content\
+ _index.md
+ posts.md (the old index.md)
+ posts\
--+ thing2.md
--+ thing3.md

(wipes froth from mouth) Thank you for coming to my void rant. I understand the issue probably could’ve been solved by diving into the routing for hugo, but my point is more towards the way it’s advertised and modern day developers’ reluctance to build clear systems with sensible or accurate reporting. If the software says it rendered 12 pages, there NEEDS to be 12 pages in the fucking output directory, and if there’s only 4 pages in output, I need 8 error messages in my build output. Now get out and go make something with hugo.