Paginating through all sections

Hello, I’m trying to create a pagination on my home page to go through all my articles sorted by weight (publisedDate). Unfortunately it seems that the paginator forces you to use the “where” feature but it’s not appropiate for me. For example, consider my content directory structure:

- content
-- personal
-- tests
-- examples

My categories (or sections for this matter) are personal, tests, and examples. When a user reaches the home page (index.html) I want them to see the latest category in any section so I have this code:

  <section id="main">
    {{ range first 10 .Data.Pages }}
      {{ .Render "list" }}
    {{ end }}

    {{ partial "pagination.html" . }}

(I haven’t figured out how to display the next 10, still on the pagination issue.)

My pagination.html partial looks like this:

{{ $paginator := .Paginate (where .Data.Pages "draft" "false") }}
<!-- Pagination -->
<div class="pagination">

  {{ if $paginator.HasPrev }}
    <a href="#">&larr; Previous</a>
  {{ end }}

  {{ if $paginator.HasNext }}
    <a href="#">Next &rarr; </a>
  {{ end }}


According to the Variables documentation, there is no “draft” setting on .Data.Pages. I’m a little lost here on how to create pagination for all my pages.


  1. Do I need to put them in a “posts” directory and search by “Type” is equal to “posts”? I hope I don’t :-X

  2. Bonus Question: My index.html is doing “range first 10 .Data.Pages”. How is the second page of the pagination going to know to list from 10 - 20? Should I be doing something programmatically there?