Home Page: Listing all p

Apologies, I probably should know the answer to this but I think I probably missed an update notification.

Somewhere between Hugo v0.55.6 which my live site is currently using and v0.67.0 which I have installed now on my dev PC, something changed in respect to listing out all of the posts and pages on the site.

I want all content to be listed on my homepage (in reverse chronological order - latest first). My content is split between posts, some pages and some knowledgebase articles.


This is the list template that currently displays everything:

{{ define "main" }}
<div class="content">

    {{- if not .IsHome -}}
    <h1 title="{{.Kind}}">{{ .Title }}</h1>
    {{- else -}}
    <h1 title="{{.Kind}}">Home</h1>
    {{- end -}}

    {{- if .Params.Description -}}
    <div class="space-below" title="Page description"><blockquote>
        {{- .Params.Description | markdownify -}}
    {{- end -}}

    {{- if .Content -}}{{/* --- Display page content, if any --- */}}
    <div class="content">{{ .Content }}</div>
    {{- end -}}

    {{/* --- List section content for the current section --- */}}
    <div class="articles">
        {{/* NB: .Data.Pages auto-filters to the "current" content level */}}
        {{- $paginator := .Paginate (where .Data.Pages.ByLastmod.Reverse "Section" "!=" "") -}}
        {{- range  $paginator.Pages -}}
            {{- partial "article-summary.html" . -}}
        {{- end -}}
        {{- template "_internal/pagination.html" . -}}

{{ end }}

I’m using my own template.

My site is here:

When running live, this is what the homepage article list looks like (lots of entries):


and when running with the latest Hugo version, it looks like this (only 3 entries):


Can anyone help me get my full list back please?

I think the change in .58 is what you are looking for.

Oops, too quick. Now my knowledgebase pages, tag and category pages also show everything whereas previously they showed only the correct subset. A bit more work to do.

That’s great, thanks for that. For other people’s reference, the list.html changes to this:

OK, in the end, I had to create a new template for the home page rather than using the list.html for everything.

Slightly annoying since only 1 line needed to be different. I expect there is a more elegant way to put it all in the list.html template but time is short.

You seem to need this for the home page (home.html):

{{- $paginator := .Paginate (where .Site.RegularPages.ByLastmod.Reverse "Section" "!=" "") -}}

And this for all other section home pages (list.html):

{{- $paginator := .Paginate (where .Data.Pages.ByLastmod.Reverse "Section" "!=" "") -}}

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