Code in tags/baseof.html and tags/list.html only works after hugo serve when --disableFastRender is flagged

Code on in layouts/tags/baseof.html and layouts/tags/list.html only runs after hugo server when --disableFastRender flag is added.

Essentially the categories and tags layouts declare a block in the baseof.html then define it in their respective list.html at layouts/tags/list.html (and the equivalent for categories).

Those blocks don’t exist in the default layouts/_default/baseof.html and layouts/_default/list.html

The code processes and adds an image to the inline background styling for the body tag.

It’s not complicated code. The partial checks for an image name in frontmatter, then processes it and inserts it.

{{- define "body" -}}
{{- partial "body/body-image.html" . -}}
{{- end -}}

While the website builds properly to public, so that it deploys correctly. When using Hugo server, either the tags page or the categories page gets the taxonomy specific code (a background image). The other taxonomy page seems to use the layouts/_default/baseof.html and layouts/_default/list.html.

I’ve emptied _gen and rebuilt, but the server problem persists. Only adding --disableFastRender flag gets hugo server to respect the code in layouts/categories and layouts/tags templates consistently.

Could this behavior be related to a configuration setting?

Out of curiosity, what happens when you do:

hugo --printPathWarnings 

Hugo returns three warnings.

The first two have been around for awhile.

There is a little code that calls path.Dir, which might be the source for the zero object. I removed the IsSet calls awhile ago. Searched recently and haven’t found any.

WARN 2023/03/18 20:23:49 .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.

The third warning when --printPathWarnings is invoked returns the following:


WARN 2023/03/18 20:23:57 Duplicate target paths: \categories\index.html (2), \categories\index.xml (2), \categories\science\index.html (2), \tags\index.html (2), \tags\index.xml (2), \tags\science\index.html (2)
Total in 8172 ms

I see now there are two content directories, off the root taxonomy nodes, with index.md files, categories/science/index.md and tags/science/index.md.

They had referenced images, but serve no function in this build and can be removed.

What’s causing this? I suspect that A is clobbering B in production mode, but B is clobbering A in server mode.

Make sure you’re doing this (correct):

content/tags/
├── tag-a/
│   └── _index.md
└── _index.md

instead of this (incorrect)

content/tags/
├── tag-a/
│   └── index.md
└── index.md

Yes, it builds with this code also, but as you say, differently in production than development:

content/tags/
├── tag-a/
│   └── index.md
└── _index.md

In this case, removing them is a solution.

Nice work

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.