hugo-geekblog/layouts/_default/single.html
Robert Kaussow 42968b6a30
feat: auto-load custom svg sprites from assets folder (#40)
BREAKING CHANGE:

The icon gdoc_telescope was removed. If you are using this icon you have to replace it.

Build-in icons are prefixed with gdoc_ now. If you use built-in icons in e.g. menus you have to rename these references!
2021-05-23 22:04:57 +02:00

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 }}