website/themes/terminal-plus-minus/layouts/partials/posts.html
2019-09-02 01:51:06 +08:00

64 lines
2.2 KiB
HTML

{{- $blogIcons := "blog-icons.svg" | absURL -}}
{{- $isListSectionsOnHome := (and .IsHome (eq $.Site.Params.listSiteSectionsOnHome true)) -}}
{{- $pages := cond ($isListSectionsOnHome) .Site.Sections .RegularPages -}}
<section class="site__pages">
{{- range (.Paginate (where $pages "File.Dir" "!=" "/")).Pages -}}
<section class="site__page">
<div class="page__header">
<h1 class="page__title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
</h1>
{{- if $.Site.Params.showPageTypeIcon -}}
<svg class="page__icon">
{{- with .File -}}
{{- $isFolder := or (eq .BaseFileName "_index") (eq .BaseFileName nil) -}}
{{- $contentType := cond $isFolder "folder" "file" -}}
<use xlink:href="{{ $blogIcons }}#{{ $contentType }}"></use>
{{- else -}}
<use xlink:href="{{ $blogIcons }}#folder"></use>
{{- end -}}
</svg>
{{- end -}}
</div>
<div class="page__meta">
<span class="page__date">
{{ .Date.Format "2006-01-02" }}
</span>
{{- with .Params.Author -}}<span class="page__author">::
{{ . }}</span>{{- end -}}
</div>
{{- if .Params.tags -}}
<div class="page__tags">
{{ range .Params.tags }}
#<a class="page__tag" rel="tag" href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
{{- . -}}
</a>&nbsp;
{{ end }}
</div>
{{- end -}}
{{- with .Params.Cover -}}
<img src="{{ . | absURL }}" class="page__cover" />
{{- end -}}
<div class="page__content">
{{ if .Description }}
{{ .Description | markdownify }}
{{ else }}
{{ .Summary | markdownify }}
{{ end }}
</div>
{{- if not .Params.showFullContent -}}
<div>
<a class="read-more button" href="{{.RelPermalink}}">{{ with $.Site.Params.readMore }}{{ . }}{{ else }}Read more{{ end }} →</a>
</div>
{{- end -}}
</section>
{{- end -}}
{{- partial "pagination.html" . -}}
</section>