hugo-geekblog/layouts/_default/single.html

31 lines
1.2 KiB
HTML
Raw Normal View History

2020-07-06 18:55:32 +00:00
{{ define "main" }}
<article class="gblog-post">
<header class="gblog-post__header">
2020-07-26 12:47:12 +00:00
{{ $source := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }}
{{ with $source }}
<picture class="gblog-post__figure">
{{ with $.Resources.GetMatch (replace (.Title) (path.Ext (.Title)) ".webp") }}
<source srcset="{{ .Permalink }}" type="image/webp">
{{ end }}
{{ $featured := .Fill (printf "950x285 %s" (default "Smart" .Params.anchor)) }}
<source srcset="{{ $featured.Permalink }}">
<img src="{{ $featured.Permalink }}" alt="{{ default $.Title .Params.description }}" >
</picture>
{{ end }}
2020-07-06 18:55:32 +00:00
<h1>{{ partial "title" . }}</h1>
</header>
<section class="gblog-markdown">
{{ partial "content" . }}
2020-07-26 12:47:12 +00:00
{{ with $source }}
{{ if .Params.credits }}
<ul class="gblog-post__credits">
<li>{{ . | humanize }} image: {{ .Params.credits | safeHTML }}</li>
</ul>
{{ end }}
{{ end }}
2020-07-06 18:55:32 +00:00
</section>
</article>
{{ end }}