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"
|
title = "zero-knowledge"
|
||||||
theme = "zero"
|
theme = "zero"
|
||||||
SectionPagesMenu = "main"
|
SectionPagesMenu = "main"
|
||||||
|
Paginate = 12
|
||||||
|
|
||||||
[taxonomies]
|
[taxonomies]
|
||||||
author = "author"
|
author = "author"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{{ partial "header.html" . }}
|
{{ partial "header.html" . }}
|
||||||
{{ partial "li" . }}
|
{{ partial "li" .Paginator }}
|
||||||
{{ partial "footer.html" . }}
|
{{ partial "footer.html" . }}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<header>
|
<header>
|
||||||
<h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
|
<h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
|
||||||
</header>
|
</header>
|
||||||
<aside>
|
<nav>
|
||||||
{{ if .PrevInSection }}
|
{{ if .PrevInSection }}
|
||||||
<a href="{{ .PrevInSection.Permalink }}">prev</a>
|
<a href="{{ .PrevInSection.Permalink }}">prev</a>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
@ -13,6 +13,10 @@
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<a href="" class="deactivated">next</a>
|
<a href="" class="deactivated">next</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
</nav>
|
||||||
|
<aside>
|
||||||
|
<span class="author">{{ .Params.author }}</span>
|
||||||
|
<span class="date">{{ dateFormat "2006-01-02 15:04" .Date }}</span>
|
||||||
</aside>
|
</aside>
|
||||||
<section>
|
<section>
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
{{ partial "header.html" . }}
|
{{ partial "header.html" . }}
|
||||||
<ul class="entries">
|
{{ partial "li.html" (.Paginate (where .Data.Pages "Section" "post")) }}
|
||||||
{{ range first 10 (where .Data.Pages "Section" "post") }}
|
|
||||||
<li>
|
|
||||||
{{ .Render "summary" }}
|
|
||||||
</li>
|
|
||||||
{{ end }}
|
|
||||||
</ul>
|
|
||||||
<a href="{{ "post" | absURL }}">older posts</a>
|
|
||||||
{{ partial "footer.html" . }}
|
{{ partial "footer.html" . }}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{{ if eq .URL "/" }}{{ .Site.Title }}{{ else }}{{ .Title }} - {{ .Site.Title }}{{ end }}</title>
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<haeder>
|
<haeder>
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
This should work, right?
|
{{ if .HasPrev }}
|
||||||
{{ if .Paginator.HasPrev }}
|
<a href="{{ .Prev.URL }}">prev</a>
|
||||||
<a href="{{ .Paginator.Prev.URL }}">prev</a>
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<a href="" class="deactivated">prev</a>
|
<a href="" class="deactivated">prev</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<ul class="entries">
|
<ul class="entries">
|
||||||
{{ range .Paginator.Pages }}
|
{{ range .Pages }}
|
||||||
<li>
|
<li>
|
||||||
{{ .Render "summary" }}
|
{{ .Render "summary" }}
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
{{ if .Paginator.HasNext }}
|
{{ if .HasNext }}
|
||||||
<a href="{{ .Paginator.Next.URL }}">next</a>
|
<a href="{{ .Next.URL }}">next</a>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<a href="" class="deactivated">next</a>
|
<a href="" class="deactivated">next</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in New Issue