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

{{- $showdate := default (default true $.Site.Params.showMetaDates) .Params.showmetadates }}
{{- $showlink := default (default true $.Site.Params.showMetaLinks) .Params.showmetalinks }}
{{- if or $showdate $showlink }}
<div class="post-meta">
{{- if $showdate }}
<span>Date:</span>
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
{{- .Date.Format (default "01-02-2006" .Site.Params.dateFmt) -}}
</time>
{{- if ne .Date .Lastmod }}
· <span>Last modified:</span>
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
{{- .Lastmod.Format (default "01-02-2006" .Site.Params.dateFmt) -}}
</time>
{{- if $showlink }}<br>{{- end }}
{{- end }} <!-- if ne .Date .Lastmod -->
{{- end }} <!-- if $showdate -->
{{- 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 }}
{{ $link := default .Identifier .RelPermalink }}
<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 -->
</div>
{{- end }} <!-- if or $showdate $showlink -->