A conditional in single.html that selects if a single post or single page is being rendered?

Hi there,

What do you mean by “single post” vs “single page”?

In Hugo, “single” is usually in reference to whether a page is a “single” or regular content page, and not a list page. [doc]

If what you mean to say is that you have content/posts/lorem.md and content/pages/ipsum.md, then generally, lorem.md and ipsum.md would both be considered single Pages, and as such would both use the _default/single.html template.

However, lorem.md would be a "posts" .Type (and "posts" .Section) in contrast with ipsum.md which would be a "pages" .Type (and "pages" .Section).

So you probably have to do something like

{{ if eq "pages" .Section }}
...
{{ else }}
...
{{ end }}

I am only guessing as to what you actually mean though. It would probably be easier if you shared your site code so we know we are talking about the same thing. Have a read here about Requesting Help .