onweru / newsroom

A simple, minimalistic Hugo theme. View Demo here
https://rooms.netlify.app/
Other
287 stars 114 forks source link

Filter pages listed in front page by Section #16

Closed julioboaro closed 4 years ago

julioboaro commented 4 years ago

Hi @onweru !

I'm in the first steps with your theme (nice job!).

I would like to filter the posts in the front page with its Type/Section. For this I wrote a new Section directory "test", in the same level os "post" and with new posts. In index.html I used:

{{ $pages := .Paginate (where .Site.RegularPages "Section" "!=" "test").ByPublishDate.Reverse }}

But this change don't take effect. I can't filter using this where condition.

Could you help me?

onweru commented 4 years ago

@julioboaro,

I will post a fix within the next day. Thanks.

onweru commented 4 years ago

@julioboaro,

I will post a fix within the next day. Thanks.

This may have to wait a while longer.

drallgood commented 4 years ago

I think I just ran into the same issue... The pagination doesn't work properly as it doesn't even use the $pages variable.

I fixed it this way:

{{- $paginator := .Paginate $pages -}}
  {{- $size := $paginator.PageSize }}
  {{- $scratch := newScratch }}
  {{- range $index, $value := $paginator.Pages }}
onweru commented 4 years ago

I think I just ran into the same issue... The pagination doesn't work properly as it doesn't even use the $pages variable.

I fixed it this way:

{{- $paginator := .Paginate $pages -}}
  {{- $size := $paginator.PageSize }}
  {{- $scratch := newScratch }}
  {{- range $index, $value := $paginator.Pages }}

Thanks for contributing @drallgood