1
0
Fork 0

添加分类页标题

This commit is contained in:
indes 2018-04-20 15:43:51 +08:00
parent 8b0a8cad83
commit 39cd560780
3 changed files with 13 additions and 4 deletions

View file

@ -22,7 +22,7 @@
<header class="post-header"> <header class="post-header">
{{ safeHTML (.Scratch.Get `firstEmoji`) }} {{ safeHTML (.Scratch.Get `firstEmoji`) }}
<a href="{{ .Permalink }}"><h2 class="post-title">{{ .Title }}</h2></a> <a href="{{ .Permalink }}"><h2 class="post-title">{{ .Title }}</h2></a>
<p class="post-meta">{{ .Date.Format "Jan 2, 2006" }} . <p class="post-meta">{{ .Date.Format "Jan 2, 2006" }} ·
{{ with .Params.categories }} {{ with .Params.categories }}
{{ $categoriesLen := len . }} {{ $categoriesLen := len . }}
{{ if gt $categoriesLen 0 }} {{ if gt $categoriesLen 0 }}

View file

@ -5,8 +5,16 @@
<p class="post-meta"> <p class="post-meta">
{{- if or .Params.author .Site.Params.author -}} {{- if or .Params.author .Site.Params.author -}}
{{ .Params.author | default .Site.Params.author }} · {{ end }} {{ .Params.author | default .Site.Params.author }} · {{ end }}
{{- .Date.Format "Jan 2, 2006" -}} {{- .Date.Format "Jan 2, 2006" -}} ·
{{ with .Params.categories }}
{{ $categoriesLen := len . }}
{{ if gt $categoriesLen 0 }}
<span>{{ i18n "post.categorized_in" }}</span>
{{ range $k, $v := . }}
<a class="category-link" href="{{ . | printf "%s%s" "/categories/" | urlize | lower | relLangURL }}">{{ . }}</a>{{ if lt $k (sub $categoriesLen 1) }}, {{ end }}
{{ end }}
{{ end }}
{{ end }}
</p> </p>
</header> </header>
<div class="post-content">{{ .Content }}</div> <div class="post-content">{{ .Content }}</div>

View file

@ -10,7 +10,8 @@
{{- if not .IsHome }} {{- if not .IsHome }}
{{- if eq .Kind "page" }}{{ .Title }} {{- if eq .Kind "page" }}{{ .Title }}
{{- else if eq .Data.Singular "tag" }}{{ .Data.Term }} {{- else if eq .Data.Singular "tag" }}{{ .Data.Term }}
{{- else }}Posts {{- else }}
{{ with .Title }}{{ . }}{{ end }}
{{- end }} - {{ end }} {{- end }} - {{ end }}
{{- .Site.Title -}} {{- .Site.Title -}}
</title> </title>