Adding a content directory tree stops posts from listing

This is my site content normally, as hand “hugo new” generated:

               | EN   

Pages | 121
Paginator pages | 3
Non-page files | 0
Static files | 175
Processed images | 0
Aliases | 41
Sitemaps | 1
Cleaned | 0

I took it upon myself to generate an extra tree of content to present some data which was a root sub-directory and three sub-directories below that. I add it and things seems to work, the pages showed, but then I noticed my “posts” page was blank. Remove this directory and posts come back. Remove some of the sub-directories and posts come back. Add directory, gone.

I noticed no paginator pages (if that is relevant, and it seems plausibly odd to me.)

               | EN   

Pages | 444
Paginator pages | 0
Non-page files | 0
Static files | 175
Processed images | 0
Aliases | 42
Sitemaps | 1
Cleaned | 0

I tried running the hugo server locally with --debug and nothing jumped out at me. Could something in my pages be busting some limit, or causing some error, such that paginators are not created? I’ve tried using a dev/debug theme to poke around, although nothing has jumped out at me, but I’m typically using “hugo-now-ui” (with some tweaks I’ve added … so thar might be dragons …)

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

I’m using hugo 'cos I’m teaching myself go, so any pointers on how to “get inside hugo” (while it is running) would be appreciated.

Please post a link to the public repository for your site. See:

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Yeah, sorry, I know you like a public repo. For old habit reasons I didn’t have a public one, but I’ve created this to contain it:

I’d like to learn about hugo, learn how to get inside it mentally and debug 'cos I really like knowing what I am building upon. Any pointers for how to trace code, how to look inside and build a mental model, would be appreciated.

The theme I am using is hugo-now-ui and I’ve made a couple of tweaks to it, in part 'cos the taxonomy wasn’t supported, but I don’t believe (I hope not) that is a factor here.

The culprit directory is NFIRS-5.0.

One other question - other than the main which is “posts” goes empty when NFIRS-5.0 is present in content - is this. I tried adding an to the NFIRS-5.0 directory, and when I do I get no content below. I tried an and got things, but I got all posts listed below the content on that index page (when I really wanted my own index, and of the sub-items.) I finally added an which seemed to work, but seemed like a hack. Clearly I don’t understand nor and would appreciate any pointers.

P.S. There might be some poorly named files in there under ./NFIRS-5.0/elements (e.g. containing % or ( or something.) I’ve tried to strip those out, but might’ve missed something. I renamed things to be to remove this factor, but it didn’t help.



Where did you make these tweaks?

The theme directory (themes/hugo-now-ui) is empty when I clone your repo with git clone --recurse-submodules

Sorry, my bad, and thansk for your patience. I am at a place with poor network. I should’ve tested the repo (I was just amazed I managed to upload it.)

I’ve now downloaded with:

git clone

… and it runs, and has theme content.



To answer your question Joe…

The main tweak was copying list.html to create taxonomy.html so I could get tags/categories. It was a shot in the dark (I didn’t know themes would not support such things) and it seemed to work.

I am hosting this in an AWS bucket and had problems with lacking trailing / so I added that to one layout.

These theme tweaks were in place before I added the folder, and are there after I remove the folder, and the posts show with them but not the folder.

hugo-now-ui adamjack$ git diff

**diff --git a/layouts/_default/list.html b/layouts/_default/list.html**

**index d7dfbbe..5aa4465 100644**

**--- a/layouts/_default/list.html**

**+++ b/layouts/_default/list.html**

@@ -1,6 +1,6 @@

 {{ define "body" }}

 {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}



 <!-- Optional Header Image -->

 {{ if .Params.header.image }}

 <div class="article-header">

**diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html**

**index 24fb311..656ce99 100644**

**--- a/layouts/_default/terms.html**

**+++ b/layouts/_default/terms.html**

@@ -6,9 +6,9 @@


{{ $data := .Data }}

{{ range $key, $value := .Data.Terms.ByCount }}

- <li><a href="/{{ $data.Plural }}/{{ $value.Name | urlize }}">{{ $value.Name }}</a> {{ $value.Count }}</li>

+ <li><a href="/{{ $data.Plural }}/{{ $value.Name | urlize }}/">{{ $value.Name }}</a> {{ $value.Count }}</li>

{{ end }}




-{{ end }}

\ No newline at end of file

+{{ end }}

Renaming content/NFIRS-5.0 to content/nfirs-5.0 will resolve the problem.

Regarding vs., this post might be helpful:

Thanks Joe, very much appreciated. I looked at all sorts of filename problems, but hadn’t considered the base of the root (manually created.)

I went back and forth with, and even … I got (seemingly) strange behaviors with both the index files, but maybe that was due to the root directory.

A few questions:

  • How did you diagnose the root directory problem? From experience, or from tracing the code, or a log message? I’d like to learn how to troubleshoot things better myself.
  • Should I just have all directories as lowercase? NFIRS is an acronym, hence my wanting to keep it uppercase.
  • Does hugo have any tracing option to log problems like this?

It didn’t pass the smell test. I never mix cases with file paths or URLs. Some operating systems are case sensitive, some are not. Some web servers are case-sensitive by default, others are not. This habit is not specific to my work with Hugo.

Yes. See above.

No. I’ll typically add warnf statements to templates to figure out what’s happening.

I also avoid dots in directory names. Why tempt fate?

Yeah, makes sense. If I’d thought about it that way I might’ve done that. As I’ve been learning go and the linter is telling me to use capitals for acronyms ( e.g. .) I viewed hugo in the go context. I appreciate you coming at it with a different perspective, and getting me back on track.

Your reference to the thread on was as helpful as you knew it would be. I do want … a branch not a leaf … but (and maybe a theme issue?) it gives me my manually (ok code) generated index … followed by a set of blog posts, i.e. completely unrelated content. I tried my manual index to try to get my list presentation and no posts, but is that a nasty hack? Should I be looking at the where clause in lists.html or somewhere else?

BTW: This theme says it is updated for hugo 0.57.0:

You need to get a handle on:

  • .Site.Pages
  • .Site.RegularPages
  • .Pages
  • .RegularPages
  • .RegularPagesRecursive

And the where function (used in conjunction with range in list pages):

It helps me to think top-down. Example use case:

When I visit, I expect to see a list of the content within the bar directory, and nothing else. Each list item should contain the title, date of publication, a featured image, and a summary.

To accomplish this:

  1. What kind of template do I need to create?
  2. Where should the template be located, and how should it be named, to conform to Hugo’s lookup order?
  3. If I’m ranging through content to build a list, how should I limit and sort the list? I think in terms of SQL:
    SELECT * FROM foo WHERE bar=baz ORDER BY quez DESC

Thanks Joe, and thank you for continuing to be very helpful - I’ll consume all those. I came at Hugo as a user and I did try read the documentation, but clearly I’ve not gotten the understanding I needed to thrive. I didn’t write the theme nor the where clause, but I can learn how to hack them. Time to dig in further.

Not sure if this is right, but reading what you referenced I used nested files and:

mkdir layouts/nfirs-5.0/
cp themes/hugo-now-ui/layouts/_default/single.html layouts/nfirs-5.0/single.html
cp themes/hugo-now-ui/layouts/_default/single.html layouts/nfirs-5.0/list.html

… which turns off the list entries below my (already constructed) list content in those pages. (I probably should’ve hand crafted a list layout for those entries, but since I’d done it already when generating the markdown I was cool with what I had.)

Check your second cp command. Was this a typographical error?

You mean the second copy … of single to list? It was intentional, albeit likely hacky. I wanted my files (that already contained formatted list content, generated by my code) NOT to have the default theme listing attached at the bottom of the page. Not pretty, but it got me branches. Sorry if that is Hugo’s idea of code smell. :slight_smile: