Skip to content

Commit

Permalink
implement pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 27, 2017
1 parent c14ca04 commit d3cd314
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ <h1>{{ .Title }}</h1>
{{ .Content }}

<ul>
{{ range (where .Data.Pages "Section" "!=" "") }}
{{ $paginator := .Paginate (where .Data.Pages "Section" "!=" "") }}
{{ range $paginator.Pages }}
<li>
<span class="date">{{ .Date.Format "2006/01/02" }}</span>
<a href="{{ .URL }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
{{ template "_internal/pagination.html" . }}

{{ partial "footer.html" . }}
5 changes: 5 additions & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ hr {
color: #ddd;
}

/* pagination */
.pagination { text-align: center; }
.pagination li { display: inline; }
.pagination a { padding: 0 .2em; }

/* code */
pre {
border: 1px solid #ddd;
Expand Down

0 comments on commit d3cd314

Please sign in to comment.