0
0
Fork 0

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:
Gibheer 2015-10-26 08:52:49 +01:00
parent 02f704abe1
commit 8ad66a802b
6 changed files with 14 additions and 16 deletions

View File

@ -3,6 +3,7 @@ languageCode = "en-us"
title = "zero-knowledge"
theme = "zero"
SectionPagesMenu = "main"
Paginate = 12
[taxonomies]
author = "author"

View File

@ -1,3 +1,3 @@
{{ partial "header.html" . }}
{{ partial "li" . }}
{{ partial "li" .Paginator }}
{{ partial "footer.html" . }}

View File

@ -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 }}

View File

@ -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" . }}

View File

@ -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>

View File

@ -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 }}