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

View File

@ -1,19 +1,18 @@
{{ define "main" }} {{ 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"> <div class="post">
<h2 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2> <h2 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2>
<div class="post-meta"> <div class="post-meta">
{{ with .Date | default nil }} {{ if .Date | default nil }}
<span class="post-date"> <span class="post-date">
{{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }} {{ .Date.Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
</span> </span>
{{ end }}
{{ if eq .Type $contentTypeName }}
{{ if $.Site.Params.LastModDisplay}} {{ if $.Site.Params.LastModDisplay}}
{{ if .Date }} {{ partial "lastmod.html" . }}
{{ with .Lastmod }}
<span class="post-moddate">
{{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
</span>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ 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 }}