Skip to content

Commit

Permalink
implement pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 5, 2020
1 parent 7edfd02 commit fa66b8c
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 @@ -9,12 +9,14 @@ <h1>{{ .Title | markdownify }}</h1>
<ul>
{{ $pages := .Pages }}
{{ if .IsHome }}{{ $pages = .Site.RegularPages }}{{ end }}
{{ range (where $pages "Section" "!=" "") }}
{{ $paginator := .Paginate (where $pages "Section" "!=" "") }}
{{ range $paginator.Pages }}
<li>
<span class="date">{{ .Date.Format "2006/01/02" }}</span>
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</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 fa66b8c

Please sign in to comment.