aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/templates/partials
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/templates/partials')
-rw-r--r--internal/web/templates/partials/postlist.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/web/templates/partials/postlist.html b/internal/web/templates/partials/postlist.html
new file mode 100644
index 0000000..01e1037
--- /dev/null
+++ b/internal/web/templates/partials/postlist.html
@@ -0,0 +1,22 @@
+{{/* The article list and pager shared by a page and a tag listing. Expects
+ .Data.posts, .Data.pageNum, .Data.lastPage and .Data.base (the listing's
+ own path, which ?p=N is appended to). */}}
+{{define "postlist"}}
+{{range .Data.posts}}
+<article class="post">
+ <h2 class="post-title"><a href="/{{.PageSlug}}/{{.Slug}}">{{.Title}}</a></h2>
+ {{if $.Data.theme.ShowDates}}<p class="post-date">{{postdate $.Data.theme.DateFormat .CreatedAt}}</p>{{end}}
+ {{template "posttags" .Tags}}
+ <div class="post-body">{{html .BodyHTML}}</div>
+</article>
+{{end}}
+{{if gt .Data.lastPage 1}}
+<div class="pager">
+ {{if gt .Data.pageNum 1}}<a href="{{.Data.base}}?p={{sub .Data.pageNum 1}}">&larr; {{t "Newer"}}</a>{{end}}
+ <span>{{tf "Page %d of %d" .Data.pageNum .Data.lastPage}}</span>
+ {{if lt .Data.pageNum .Data.lastPage}}<a href="{{.Data.base}}?p={{add .Data.pageNum 1}}">{{t "Older"}} &rarr;</a>{{end}}
+</div>
+{{end}}
+{{end}}
+
+{{define "posttags"}}{{if .}}<p class="post-tags">{{range .}}<a href="/tag/{{.Slug}}">{{.Name}}</a> {{end}}</p>{{end}}{{end}}