This repository has been archived on 2024-09-02. You can view files and clone it, but cannot push or open issues or pull requests.
hugo-theme-nocolor/layouts/partials/post_meta.html

37 lines
1.7 KiB
HTML
Raw Normal View History

2020-12-28 20:12:36 +01:00
{{- $showdate := default (default true $.Site.Params.showMetaDates) .Params.showmetadates }}
{{- $showlink := default (default true $.Site.Params.showMetaLinks) .Params.showmetalinks }}
{{- if or $showdate $showlink }}
2019-11-20 19:56:22 +01:00
<div class="post-meta">
2020-12-28 20:12:36 +01:00
{{- if $showdate }}
<span>Date:</span>
2019-11-20 19:56:22 +01:00
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
2020-12-28 20:12:36 +01:00
{{- .Date.Format (default "01-02-2006" .Site.Params.dateFmt) -}}
2020-12-28 21:14:09 +01:00
</time>
2020-12-28 20:12:36 +01:00
{{- if ne .Date .Lastmod }}
2020-12-28 21:14:09 +01:00
· <span>Last modified:</span>
2020-12-28 21:08:09 +01:00
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
{{- .Lastmod.Format (default "01-02-2006" .Site.Params.dateFmt) -}}
2020-12-28 21:14:09 +01:00
</time>
{{- if $showlink }}<br>{{- end }}
2020-12-28 20:12:36 +01:00
{{- end }} <!-- if ne .Date .Lastmod -->
{{- end }} <!-- if $showdate -->
2019-11-20 19:56:22 +01:00
2020-12-28 20:12:36 +01:00
{{- if $showlink }}
{{- $fallback := slice (dict "Identifier" "Categories") (dict "Identifier" "Series") (dict "Identifier" "Tags") }}
{{- range default $fallback .Site.Menus.meta }}
{{- $taxo := $.Param .Identifier }}
{{- if $taxo }}
{{ $name := default .Identifier .Name }}
2020-12-28 22:04:31 +01:00
{{ $link := default .Identifier .RelPermalink }}
2020-12-28 20:12:36 +01:00
<span{{ if .Title }} title="{{ .Title }}"{{ end }}>{{ $name }}:</span> &#x5b;
{{- range $taxo }}
{{- $perma := lower (path.Join $link (urlize .)) }}
<a href="{{ $perma | relURL }}">{{ . }}</a>
{{- end }} <!-- range $taxo -->
&#x5d;
{{- end }} <!-- if $taxo -->
{{- end }} <!-- range default $fallback .Site.Menus.meta -->
{{- end }} <!-- - if $showlink -->
2019-11-20 19:56:22 +01:00
</div>
2020-12-28 20:12:36 +01:00
{{- end }} <!-- if or $showdate $showlink -->