Can I use .Render to call . single.html of another section?


I have a Resources post type, and need to also add a “Guest Stories” post type.

The only difference between the two post types, is the slug (and content, of course!). The design of both pages is actually the exact same.

Is there a way I can point Hugo to look at the layouts/resources/list.html and layouts/resources/single.html layout pages, for my new “guest-stories” post type?

The question in the title of the topic is different than what you are writing in your post.

Can I use .Render to call single.html of another section?

Use the layout parameter in the front matter of a content file to call the single.html template of another section.

Both layouts for list and single page, cannot be called at the same time.

Didn’t say I wanted both layouts to be called at the same time lol

How can I do the former without relying on front matter fields?

The simplest way is to use front matter parameters.

Regarding .Render I quote from this post:

The other way would be to use conditional logic in your layouts/_default/ templates to output different layouts per .Page Type/Section.

However the latter can get convoluted. Also to achieve it you would need to use one template to rule everything.

Also do note that resources is a reserved name space in Hugo. See:

I would rename the Resources post type -if I were you- to avoid possible problems down the line.