w2ng/themes/hugo-w2ng/layouts/_default/list.html
2020-01-08 20:57:27 +08:00

46 lines
1.5 KiB
HTML

{{ define "main" }}
<div class="max-w-3xl mx-auto leading-relaxed my-6">
{{- partial "meta.html" . -}}
<div class="markdown">
{{ .Content }}
</div>
{{- $pctx := . -}}
{{- $pages := $pctx.RegularPages -}}
{{- if .IsHome -}}
{{ $pages = .Site.RegularPages }}
{{ "**精选:**" | markdownify }}
{{- end -}}
{{ range $pages }}
<article itemscope itemtype="http://schema.org/Article" class="flex flex-col mt-6 mb-12">
{{ if (eq $pctx.Kind "taxonomy") }}
{{ .Scratch.Set "taxonomy" (add $pctx.Type $pctx.Title) }}
{{ end }}
{{- partial "taxonomy.html" . -}}
<h2 itemprop="name" class="text-2xl"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<p itemprop="datePublished" content="{{ .Date.Format "2006-01-02" }}" class="">{{ .Date.Format "2006/01/02" }}
</p>
<div class="py-2">
{{ if .Description }}
{{ .Description | markdownify }}
{{ else }}
{{ if .Truncated }}
{{ .Summary | truncate 150 | markdownify }}...
{{ end }}
{{ end }}
</div>
</article>
{{ end }}
{{- if .IsHome -}}
{{ range $tagName, $taxonomy := .Site.Taxonomies.categories }}
{{ with $.Site.GetPage (printf "%s/%s" "categories" $tagName) }}
<a href="{{ .Permalink }}">{{ $tagName }}</a>({{ len $taxonomy }})
{{ end }}
{{ end }}
{{ .Page.Site.Params.HomeDesc | markdownify }}
{{ end }}
</div>
{{ end }}