Listing posts across sections

Right now, my theme uses sections to divide content in ‘stories’. The source code is here: https://github.com/brunoamaral/future-imperfect-DI

The index page lists just the most recent post, and clicking the next page link takes you to posts/page/2

Of course this does not list content outside of the /post folder. How would I go about keeping this behaviour and list all posts in the next page?

Which behavior are you referring to? You want to paginate all single pages in the post listing?

I am not sure pagination works like that. You might be able to create a pagination of all content and base it off the home page.

The paginator pages part of the docs gives clues to where .Paginator can be used, and how.

I was referring to have just one recent post on the homepage and a button to a page that lists all the content.

Sorry, not clear enough for me. And I don’t have a test site with content to check the theme. If you want to share a repo, or explain in more detail what you are looking for, I might be able to help. Hopefully someone will come along that gets yer request. :slight_smile:

Can’t test right now, but the way I would go about it would be to skip the pagination from the index.

Have the recent post on the home page as you do. Then point that button to a page where you list everything. .Site.GetPage coupled with where is the way to do this.

1 Like

I’m still trying to figure this out, adapting the code I was using for the homepage isn’t working in the new type of layout:

{{ $loop := (where (where .Data.Pages "Type" "!=" "page") ".Params.unlisted" "!=" true ) }}
{{range .Paginate $loop  }}
	{{ .Render "summary"}}
{{ end }}

This always returns

Building sites … ERROR 2018/02/04 11:51:12 Error while rendering "page" in "page/": template: theme/page/allposts.html:19:16: executing "theme/page/allposts.html" at <.Paginate>: error calling Paginate: Paginators not supported for pages of type "page" ("all posts")

And every variation either doesn’t return a layout or goes back to an error about Pages not usable in Paginate.

What am I missing?