Add better series taxonomy list and clean up post metadata

This commit is contained in:
2021-11-13 17:04:10 -06:00
parent 21180991c0
commit 96893d7de6
11 changed files with 172 additions and 81 deletions

View File

@ -0,0 +1,19 @@
{{ with .Params.authors }}
<span class="post-meta-item">
{{ partial "icon.html" "user-circle" }}
{{ if index $.Site.Taxonomies "authors" }}
{{ $authors := slice }}
{{ range . }}
{{ $url := (printf "authors/%s" (. | anchorize)) | absLangURL }}
{{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url . | safeHTML) }}
{{ end }}
{{ delimit $authors ", " }}
{{ else }}
{{ delimit . ", " }}
{{ end }}
</span>
{{ end }}

View File

@ -0,0 +1,18 @@
{{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime }}
<div class="post-metadata">
{{ if .Date }}
<span class="post-meta-item">
{{ partial "icon.html" "calendar" }}
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
</time>
</span>
{{ end }}
{{ partial "authors-meta-item.html" . }}
{{ partial "translations-meta-item.html" . }}
{{ partial "readingtime-meta-item.html" . }}
{{ partial "series-meta-item.html" . }}
{{ partial "tags-meta-item.html" . }}
</div>
{{ end }}

View File

@ -1,4 +1,4 @@
{{ if or .Date .IsTranslated .Site.Params.readingtime .Site.Params.repoURL }}
{{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime .Site.Params.gitFileURL }}
<div class="post-metadata">
{{ if .Date }}
<span class="post-meta-item">
@ -19,74 +19,11 @@
</span>
{{ end }}
{{ with .Params.authors }}
<span class="post-meta-item">
{{ partial "icon.html" "user-circle" }}
{{ if index $.Site.Taxonomies "authors" }}
{{ $authors := slice }}
{{ range . }}
{{ $url := (printf "/authors/%s" (. | anchorize)) | absLangURL }}
{{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url . | safeHTML) }}
{{ end }}
{{ delimit $authors ", " }}
{{ else }}
{{ delimit . ", " }}
{{ end }}
</span>
{{ end }}
{{ if .IsTranslated }}
<span class="post-meta-item">
{{ partial "icon.html" "world" }}
{{ range .Translations }}
<a href="{{ .Permalink }}">{{ .Language }}</a>
{{ end }}
</span>
{{ end }}
{{ if ne .Site.Params.readingtime false }}
<span class="post-meta-item">
{{ partial "icon.html" "clock" }}
{{ i18n "readingtime" .ReadingTime }}
</span>
{{ end }}
{{ with .Site.Params.gitFileURL }}
<span class="post-meta-item">
{{ with $.Site.Params.gitFileIcon }}
{{ partial "icon.html" . }}
{{ else }}
{{ partial "icon.html" "file" }}
{{ end }}
<a href="{{ printf "%s/content/%s" . $.File.Path }}" target="_blank" rel="noopener">
View source
</a>
</span>
{{ end }}
{{ with .Params.series }}
<div class="series">
{{ range ($.GetTerms "series") }}
<span class="post-meta-item">
{{ partial "icon.html" "files" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span>
{{ end }}
</div>
{{ end }}
<div class="tags">
{{ range (.GetTerms "tags") }}
<span class="post-meta-item">
{{ partial "icon.html" "tag" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span>
{{ end }}
</div>
{{ partial "authors-meta-item.html" . }}
{{ partial "translations-meta-item.html" . }}
{{ partial "readingtime-meta-item.html" . }}
{{ partial "viewsource-meta-item.html" . }}
{{ partial "series-meta-item.html" . }}
{{ partial "tags-meta-item.html" . }}
</div>
{{ end }}

View File

@ -0,0 +1,6 @@
{{ if ne .Site.Params.readingtime false }}
<span class="post-meta-item">
{{ partial "icon.html" "clock" }}
{{ i18n "readingtime" .ReadingTime }}
</span>
{{ end }}

View File

@ -0,0 +1,10 @@
{{ with .Params.series }}
<div class="series">
{{ range ($.GetTerms "series") }}
<span class="post-meta-item">
{{ partial "icon.html" "files" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span>
{{ end }}
</div>
{{ end }}

View File

@ -0,0 +1,8 @@
<div class="tags">
{{ range (.GetTerms "tags") }}
<span class="post-meta-item">
{{ partial "icon.html" "tag" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span>
{{ end }}
</div>

View File

@ -0,0 +1,8 @@
{{ if .IsTranslated }}
<span class="post-meta-item">
{{ partial "icon.html" "world" }}
{{ range .Translations }}
<a href="{{ .Permalink }}">{{ .Language }}</a>
{{ end }}
</span>
{{ end }}

View File

@ -0,0 +1,13 @@
{{ with .Site.Params.gitFileURL }}
<span class="post-meta-item">
{{ with $.Site.Params.gitFileIcon }}
{{ partial "icon.html" . }}
{{ else }}
{{ partial "icon.html" "file" }}
{{ end }}
<a href="{{ printf "%s/content/%s" . $.File.Path }}" target="_blank" rel="noopener">
View source
</a>
</span>
{{ end }}