Hugo个人博客搭建过程参考Hugo个人博客搭建
在layouts/partials
目录下创建 post_meta.html
cp themes/hugo-PaperMod-master/layouts/partials/post_meta.html layouts/partials/post_meta.html
vim layouts/partials/post_meta.html
将一下部分的内容
{{- if not (.Param "hideAuthor") -}}
{{- with (partial "author.html" .) }}
{{- $scratch.Add "meta" (slice .) }}
{{- end }}
{{- end }}
修改为
{{- $author := (partial "author.html" .) }}
{{- $tags := (partial "tags.html" .) }}
{{- if not (.Param "hideAuthor") -}}
{{- if $tags }}
{{- $scratch.Add "meta" (slice $author $tags) -}}
{{- else}}
{{- $scratch.Add "meta" (slice $author) -}}
{{- end}}
{{- else}}
{{- if $tags }}
{{- $scratch.Add "meta" (slice $tags) -}}
{{- end}}
{{- end }}
在layouts/partials
目录下创建tags.html
vim layouts/partials/tags.html
tags.html
文件内容为:
{{- $tags := .Params.tags -}}
{{- if $tags -}}
{{- $lastIndex := sub (len $tags) 1 -}}
{{- range $index, $tag := $tags -}}
<a href="/tags/{{ $tag | urlize }}"> {{ $tag }}</a>
{{- if ne $index $lastIndex }} · {{ end -}}
{{- end -}}
{{- end -}}