Sort posts from more sections

On my homepage I’m usign pagination and I want to display posts from two section ordere by date. However, the order is kept within the sections but one older post from one section is above some younger posts from the other section. Here is the code I’m using:

{{ $paginator := .Paginate (where (where .Site.Pages "Section" "in" (slice "flash" "story") ) "IsPage" true) }}
{{ range $index, $element := .Paginator.Pages.ByDate.Reverse }}

On the 2nd line, try replacing .Paginator with the $paginator variable you declared (untested)

I’ve already tried what you suggest, but no post are displayed then, the page stays empty.

I would have to see your code to troubleshoot further.

But on my laptop, given this content structure:

├── content
│   ├── flash
│   │   ├── flash1.md
│   │   └── flash2.md
│   ├── nope
│   │   ├── nope1.md
│   │   └── nope2.md
│   └── story
│       ├── story1.md
│       └── story2.md

And this template code:

{{ $paginator := .Paginate (where (where .Site.Pages "Section" "in" (slice "flash" "story") ) "IsPage" true) }}

<ul>
{{- range $index, $element := $paginator.Pages.ByDate.Reverse }}
  <li><a href="{{ .Permalink }}">{{ .Title }} -- {{ .Date }}</a></li>
{{- end }}
</ul>

I get this output:

<ul>
  <li><a href="http://example.org/story/story2/">Story2 -- 2018-11-19 09:14:27 -0600 CST</a></li>
  <li><a href="http://example.org/story/story1/">Story1 -- 2018-11-19 09:14:27 -0600 CST</a></li>
  <li><a href="http://example.org/flash/flash2/">Flash2 -- 2018-11-19 09:14:27 -0600 CST</a></li>
  <li><a href="http://example.org/flash/flash1/">Flash1 -- 2018-11-19 09:14:01 -0600 CST</a></li>
</ul>

Thanks for trying to help realy appreaciate it.
Actually on the first page of the paginator the content is ordered by date correctly.
The issue is that on the second page of the paginatior is some younger content than the last one on the first page.

page1
flash5 (2018-11-20)
flash4 (2018-11-19)
story1 (2018-08-15)

page2
flash3 (2018-10-15)
flash2 (2018-10-03)
flash1 (2018-08-04)

I see. So, you will need to share your code for me to troubleshoot further.

If you can’t do that, then create a sample repo that reproduces your issue, then share that.

Okay I see the line you’re talking about now, but I’m not sure how to fix. Perhaps someone else more familiar with pagination can help you.

Actually I figured it out… by adding .ByDate.Reverse in the the first line (L4), where the paginator is created … thanks anyway for your help.