Hugo

Questions about list layout

I have list.html file inside layouts/_default.

My content folder looks like that:

I want to get the name of the folder inside of this list.html file and change the page’s title. Could you help me with that? I want the title to be different for every list. For example, if it is Canada, I want it to be: “Student Stories | Canada”, if it is the Netherlands, I want the title to be “Student Stories | Netherlands”

there are different ways to do it

1st use different directories ./canada ./netherlands etc… use {{.section}} in the title
2nd set a parameter in frontmatter country: “Netherlands” and use {{.param.country}}
3rd a lot more :wink:

1 Like

Sorry, but I don’t really understand either ways :frowning:

  1. I tried to render {{ .section }} in list.html, but I got error executing "main" at <.section>: can't evaluate field section in type *hugolib.pageState
  2. This I didn’t understand at all :frowning: