Building pages from data (single layout)

I followed this tutorial

  1. but I cannot get the single.html file to work, while the list.html file does. Both are placed inside themes/theme-name/layouts/health folder. Is there anything I need to do to make the single.html file to work?
$ hugo env
hugo v0.109.0-47b12b83e636224e5e601813ff3e6790c191e371+extended windows/amd64 BuildDate=2022-12-23T10:38:11Z VendorInfo=gohugoio
  1. How do I change the title of the mounted section? Can an be placed in there?

cc @regis

Hi @steppa. I’m not sure, can’t say without seeing your single.html file or even better the repo.

Yes you can add an in your main project’s folder. (Rather than the remote one)

PS: There was a formating issue on this article. I fixed that.

It is nothing special. But the imported files default to the one inside the _default folder. I made a copy of it and edited it to include the data in the front matter then put it in layouts/health folder (replacing monsters with health for testing purposes).

Since the content is mounted, how do I do that, since in content, that folder does not exist?

So you’re saying hugo does use layouts/heatlh/list.html for the mounted files list template but not layouts/health/single.html?

You can go ahead and create the folder in your main project with the in it. Any existing files in there will cohabit with the mounted ones.

Yes, for the individual pages. (Edit: I cascaded the layout and it works now)

This worked.

@regis are the pages supposed to be wrapped in --- for YAML?

the front matter should be in the markdown file yes…

title: Hello
authors: Me
My body content... 

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