Help creating a list of pages, by section, on homepage

Hello,

I am a first time user of Hugo. I decided to delve in by starting with a template, using the Netlify one-click-hugo-cms as my basis. My troubles began when I tried to add a list of pages to my homepage. What I’m trying to achieve is a list of the most recent pages in a section called reviews.

I created a partial called home-reviews and tried every combination of code I could find online to make the list. Hugo builds the site with no errors, but the content I’m hoping for is missing. Please check out my work in the staging brand of my github repo: https://github.com/a8FGb109/one-click-hugo-cms/

indent preformatted text by 4 spaces
<div class="mw7 center">
    <ul class="flex-ns flex-wrap mhn1-ns pa3">
        {{ $paginator := .Paginate (where .Site.Pages "Section" "reviews") 4 }}
        {{ range .Paginator.ByPublishDate.Reverse }}
        <div class="w-50-ns ph1-ns flex">
          {{ .Render "li"}}
        </div>
        
        {{ end }}
        
    </ul>
 
  </div>

I’ve been stuck on this seemingly simple thing for the last 3 days. Your help will be greatly appreciated!

You can NOT use the paginator for lists.

{{ range $index, $element := first 10 (where site.RegularPages "Section" "eq" "reviews") }}
	<div >
		{{.Render "summary"}}
	</div>
{{ end }}

Thank you so much for you help! This worked great. I was missing the summary layout, so I created that and it worked.

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