There’s an example and information on the List Templates page of the Hugo website.
ie…
{{ range first 10 .Data.Pages }}
{{ .Render “summary”}}
{{ end }}
or…
{{ range first 5 (where .Data.Pages.ByDate “Section” “posts”) }}
There’s an example and information on the List Templates page of the Hugo website.
ie…
{{ range first 10 .Data.Pages }}
{{ .Render “summary”}}
{{ end }}
or…
{{ range first 5 (where .Data.Pages.ByDate “Section” “posts”) }}
I’m trying to use this tip to adapt the homepage template of the hyde theme. All I’ve changed is this:
{{ range first 2 .Data.Pages.Reverse }}
{{ .Render "summary"}}
The number limit and the reverse order work fine, but the summary doesn’t (all the content appears on the page).
The documentation says that the summary is automatically generated so I assume that there’s nothing that I should define in my content’s front matter:
.Summary A generated summary of the content for easily showing a snippet in a summary view.
(from the template variables page).
What I’m missing?
Ok, got it. I replaced {{ .Content }}
with {{ .Summary }}
and now it works as expected.
Thanks