inject paginator
This makes it possible to use the paginator on the index page without problems. The li.html now only lists the articles.
This commit is contained in:
parent
02f704abe1
commit
8ad66a802b
|
@ -3,6 +3,7 @@ languageCode = "en-us"
|
|||
title = "zero-knowledge"
|
||||
theme = "zero"
|
||||
SectionPagesMenu = "main"
|
||||
Paginate = 12
|
||||
|
||||
[taxonomies]
|
||||
author = "author"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{{ partial "header.html" . }}
|
||||
{{ partial "li" . }}
|
||||
{{ partial "li" .Paginator }}
|
||||
{{ partial "footer.html" . }}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<header>
|
||||
<h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
|
||||
</header>
|
||||
<aside>
|
||||
<nav>
|
||||
{{ if .PrevInSection }}
|
||||
<a href="{{ .PrevInSection.Permalink }}">prev</a>
|
||||
{{ else }}
|
||||
|
@ -13,6 +13,10 @@
|
|||
{{ else }}
|
||||
<a href="" class="deactivated">next</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
<aside>
|
||||
<span class="author">{{ .Params.author }}</span>
|
||||
<span class="date">{{ dateFormat "2006-01-02 15:04" .Date }}</span>
|
||||
</aside>
|
||||
<section>
|
||||
{{ .Content }}
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
{{ partial "header.html" . }}
|
||||
<ul class="entries">
|
||||
{{ range first 10 (where .Data.Pages "Section" "post") }}
|
||||
<li>
|
||||
{{ .Render "summary" }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<a href="{{ "post" | absURL }}">older posts</a>
|
||||
{{ partial "li.html" (.Paginate (where .Data.Pages "Section" "post")) }}
|
||||
{{ partial "footer.html" . }}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>{{ if eq .URL "/" }}{{ .Site.Title }}{{ else }}{{ .Title }} - {{ .Site.Title }}{{ end }}</title>
|
||||
<link href="{{ .Site.BaseURL }}/style.css" rel="stylesheet" type="text/css"></link>
|
||||
</head>
|
||||
<body>
|
||||
<haeder>
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
This should work, right?
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<a href="{{ .Paginator.Prev.URL }}">prev</a>
|
||||
{{ if .HasPrev }}
|
||||
<a href="{{ .Prev.URL }}">prev</a>
|
||||
{{ else }}
|
||||
<a href="" class="deactivated">prev</a>
|
||||
{{ end }}
|
||||
<ul class="entries">
|
||||
{{ range .Paginator.Pages }}
|
||||
{{ range .Pages }}
|
||||
<li>
|
||||
{{ .Render "summary" }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ if .Paginator.HasNext }}
|
||||
<a href="{{ .Paginator.Next.URL }}">next</a>
|
||||
{{ if .HasNext }}
|
||||
<a href="{{ .Next.URL }}">next</a>
|
||||
{{ else }}
|
||||
<a href="" class="deactivated">next</a>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue