hugo-geekblog/layouts/_default/single.html

46 lines
2.0 KiB
HTML

{{ define "main" }}
<article class="gblog-post">
<header class="gblog-post__header">
{{ $source := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }}
{{ with $source }}
<div class="gblog-post__feature">
<picture>
{{ $featured := .Fill (printf "910x280 %s" (default "Smart" .Params.anchor)) }}
<source srcset="{{ $featured.Permalink }}">
<img src="{{ $featured.Permalink }}" alt="{{ default $.Title .Params.description }}" >
</picture>
{{ with $source.Params.credits }}
<span>Credits: {{ . | $.Page.RenderString | safeHTML }}</span>
{{ end }}
</div>
{{ end }}
<h1>{{ partial "title" . }}</h1>
{{ if or (eq .Type (default "posts" .Site.Params.GeekblogContentSection)) (eq .Type "post") }}
<div class="gblog-post__meta">
<span class="no-wrap">
<svg class="icon gblog_date"><use xlink:href="#gblog_date"></use></svg>
<span class="gblog-post__tag">
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
{{ if ne (.Lastmod.Format "2006-01-02") (.Date.Format "2006-01-02") }}
Updated on
{{ end }}
{{ .Lastmod.Format "Jan 2, 2006" }}
</time>
</span>
</span>
<span class="no-wrap">
<svg class="icon gblog_timer"><use xlink:href="#gblog_timer"></use></svg>
<span class="gblog-post__tag">{{ .ReadingTime }} min read</span>
</span>
</div>
{{ end }}
</header>
<section class="gblog-markdown">
{{ partial "content" . }}
</section>
</article>
{{ end }}