Skip to content
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

Include only articles in the paginator #265

Open
briandfoy opened this issue Aug 9, 2020 · 0 comments
Open

Include only articles in the paginator #265

briandfoy opened this issue Aug 9, 2020 · 0 comments
Labels
hugo: templates site: enhancement The website could be better or different

Comments

@briandfoy
Copy link
Contributor

In the _defaults/list.html template, we have a paginator like this (once my jQuery stuff lands):

    {{ range $index, $page := .Paginator.Pages }}
      {{ if not (isset $page.Params "exclude_paginate") }}
        {{ .Render "li" }}
      {{ end }}
    {{ end }}
    {{ partial "pagination.html" .Paginator }}

Previously this excluded about.md by name because it was the only special page.

Instead of iterating over all pages then looking at their params, l'd like to make the paginator from only those that we should include. I've introduced an "exclude_pagination" param, but that is probably stupid. It's good for now.

I think we really want something like this, which is not correct syntactically. We select all the pages to include, then paginate that list.

  {{ range $index, $page := .Paginate( (where .Params "Type" "is" "article").Pages) }}
@briandfoy briandfoy added site: enhancement The website could be better or different hugo: templates labels Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hugo: templates site: enhancement The website could be better or different
Projects
None yet
Development

No branches or pull requests

1 participant