[Solved] Can union and GroupByDate work together?

I want to get a combined list of pages from the section and pages with the research: true in FM. This is a template for the section.

\layouts\section\articles.html

{{ $unionlist := union (where .Site.RegularPages "Params.research" true) .Data.Pages }}
{{ range $unionlist.GroupByDate "2006" }}
      <h4><time>{{ .Key }}</time></h4>
      <ul>
        {{ range .Pages  -}}
            {{ .Render "li" }}
        {{- end }}
      </ul>
{{ end }}

But this code generates only a list of pages from the section, pages with the research: true in the list is not added.

I think you’re using the union incorrectly. Try this:

{{ $unionlist := (where .Site.RegularPages "Params.research" true) | union .Data.Pages }}

Thanks and apologies. I found an error in my template outside of this code. The original code works correctly.