New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Union with a empty Pages results in empty Pages #3686

vjeantet opened this Issue Jul 8, 2017 · 0 comments


None yet
2 participants

vjeantet commented Jul 8, 2017

Hello, i have strange behavior trying to union .Pages and .Sections when the last set of the two is empty.
{{ $pages := .Pages | union .Sections }}

When .Pages.Len > 1 and .Sections.Len = 0 (empty)
Then $pages.Len = 0

Expected $pages.Len == .Pages.Len

Current workaround is

{{ .Scratch.Set "pages" .Pages }}
{{ if .Sections}}
   {{ .Scratch.Set "pages" (.Pages | union .Sections) }}
{{ $pages := (.Scratch.Get "pages") }}

Hugo 0.25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment