blob: 7f96a985b30277c291b6849d06d657d8a75097d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
{{ define "title" }}
{{ if eq .Data.Singular "tag" }}Tag → {{ .Data.Term }}
{{ else if eq .Data.Singular "category" }}Category → {{ .Data.Term }}
{{ else }}
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}
{{ .Name }}
{{ end }}
{{ end }}
{{ end }}
{{ if isset .Site.Params "seotitle" }} | {{ .Site.Params.seotitle }}{{ else }} | {{ .Site.Title }}{{ end }}
{{ end }}
{{ define "main" }}
<section class="main entry-list">
<header class="list-header">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}
<h2 class="list-label">{{ .Name }} Posts</h2>
{{ end }}
{{ end }}
</header>
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") (index .Site.Params "paginate" | default 10) }}
{{ if ne $paginator.TotalPages 0 }}
{{ range $paginator.Pages.ByDate.Reverse }}
{{ .Render "summary" }}
{{ end }}
{{ else }}
<p>There's nothing here.<br>Create an interesting post with the command:</p>
<p><code>$ hugo new post/hello-world.md</code></p>
{{ end }}
{{ if gt $paginator.TotalPages 1 }}
<nav class="pagination">
{{ if $paginator.HasPrev }}
<a class="pagination-btn" href="{{ $paginator.Prev.URL }}">← Newer Posts</a>
{{ end }}
{{ if $paginator.HasNext }}
<a class="pagination-btn pagination-next" href="{{ $paginator.Next.URL }}">Older Posts →</a>
{{ end }}
</nav>
{{ end }}
</section>
{{ end }}
|