npqhugo/layouts/index.html

58 lines
2.5 KiB
HTML
Raw Normal View History

2020-04-11 19:28:48 +08:00
{{define "main"}}
{{if .Site.Params.displayHomeContent}}
{{.Content}}
{{end}}
2020-04-11 20:51:04 +08:00
{{if ne .Site.Params.displayRecent false}}
2020-04-11 19:28:48 +08:00
<div class="section">
<div class="section-title">recent</div>
2020-04-11 21:52:56 +08:00
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
2020-04-12 02:58:41 +08:00
{{range first (default 4 .Site.Params.recentMax) (where $pages "Section" "ne" .Site.Params.microBlogSection)}}
2020-04-11 19:28:48 +08:00
<div class="list-item">
<a class="entry-title" href="{{ .URL }}">{{ .Title }}</a>
{{$page := .}}
{{with .Description}}
<p>{{.}}</p>
{{end}}
<div class="meta">
{{with .Date}}
<i class="far fa-calendar-alt"></i> {{.Format "Jan 2 2006"}}
{{end}}
<br>
{{with .Params.tags}}
<i class="fas fa-tags"></i>
Tags: {{ delimit . ", " }}
{{end}}
</div>
</div>
{{end}}
</div>
{{end}}
{{if .Site.Params.displayMicroBlog}}
<div class="section">
<div class="section-title">μblog</div>
<div class="posts">
2020-04-13 18:01:59 +08:00
{{ range where (where site.RegularPages "Type" "in" site.Params.microBlogSection) "Params.pinned" true }}
<div class="post">
<div class="meta pinned"> <i class="fas fa-thumbtack"></i> pinned </div>
<div class="post-content">
{{.Content}}
</div>
<div class="meta post-footer"> <span>{{.Date.Format "Jan 2 2006 03:04 UTC-07"}}</span> <a href="{{.URL}}"><i class="fas fa-link"></i> link</a></div>
</div>
{{ end }}
{{ range where (where site.RegularPages "Type" "in" site.Params.microBlogSection) "Params.pinned" "ne" true}}
2020-04-11 19:28:48 +08:00
<div class="post">
{{if ne .Params.pinned nil}}
<div class="meta pinned"> <i class="fas fa-thumbtack"></i> pinned </div>
{{end}}
<div class="post-content">
{{.Content}}
</div>
<div class="meta post-footer"> <span>{{.Date.Format "Jan 2 2006 03:04 UTC-07"}}</span> <a href="{{.URL}}"><i class="fas fa-link"></i> link</a></div>
</div>
{{ end }}
</div>
</div>
{{end}}
{{end }}