add panr mods

This commit is contained in:
Adam Ormsby 2019-11-30 13:18:09 +07:00
parent 4cfe93ec29
commit cbbacd5b5e
3 changed files with 28 additions and 26 deletions

View File

@ -1,14 +1,14 @@
{{ define "main" }}
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
{{ $PageContext := . }}
{{ if .IsHome }}
{{ $PageContext = .Site }}
{{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
<div class="posts">
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
{{ $PageContext := . }}
{{ if .IsHome }}
{{ $PageContext = .Site }}
{{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
{{ range $paginator.Pages }}
<div class="post on-list">
<h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
@ -17,12 +17,9 @@
<span class="post-date">
{{ .Date.Format ($.Site.Params.DateFormatList | default "2006-01-02") }}
</span>
{{ if $.Site.Params.LastModDisplay}}
{{ with .Lastmod }}
<span class="post-moddate">
{{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
</span>
{{ end }}
{{ partial "lastmod.html" . }}
{{ end }}
{{ end }}
{{ with .Params.Author }}<span class="post-author">— {{ $.Site.Params.WrittenBy | default "Written by" }} {{ . }}</span>{{ end }}
@ -31,7 +28,6 @@
{{ end }}
</div>
{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
@ -62,4 +58,4 @@
{{ end }}
{{ partial "pagination.html" . }}
</div>
{{ end }}
{{ end }}

View File

@ -1,19 +1,18 @@
{{ define "main" }}
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
<div class="post">
<h2 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2>
<div class="post-meta">
{{ with .Date | default nil }}
{{ if .Date | default nil }}
<span class="post-date">
{{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
{{ .Date.Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
</span>
{{ end }}
{{ if $.Site.Params.LastModDisplay}}
{{ if .Date }}
{{ with .Lastmod }}
<span class="post-moddate">
{{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
</span>
{{ if eq .Type $contentTypeName }}
{{ if $.Site.Params.LastModDisplay}}
{{ partial "lastmod.html" . }}
{{ end }}
{{ end }}
{{ end }}
@ -72,4 +71,4 @@
{{ partial "comments.html" . }}
</div>
{{ end }}
{{ end }}

View File

@ -0,0 +1,7 @@
{{ if gt .Lastmod .Date }}
{{ with .Lastmod }}
<span class="post-moddate">
({{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }})
</span>
{{ end }}
{{ end }}