mirror of
https://github.com/thegeeklab/hugo-geekdoc.git
synced 2024-11-15 17:30:40 +00:00
Robert Kaussow
5c5e2d59cb
BREAKING CHANGE: We have replaced `gulp` with `webpack` and `npm scripts` to build this theme. If you build it on your own or use build commands during the deployment, you may have to adjust your setup. BREAKING CHANGE: The `GeekblogIcons` font is using the icon name as Unicode now. As a consequence, you have to replace all references to Icons from this font if you have customized the theme. BREAKING CHANGE: We have refactored the search integration to split Hugo templates from JavaScript code. To get it working again, you need to adjust the `outputFormats` and `outputs` in your Hugo configuration file, as [documented](https://geekdocs.de/usage/configuration/#site-configuration).
45 lines
1.4 KiB
HTML
45 lines
1.4 KiB
HTML
{{ $source := ($.Page.Resources.ByType "image").GetMatch (printf "%s" (.Get "name")) }}
|
|
{{ $customAlt := .Get "alt" }}
|
|
{{ $customSize := .Get "size" }}
|
|
{{ $lazyLoad := default (default true $.Site.Params.GeekdocImageLazyLoading) (.Get "lazy") }}
|
|
|
|
{{ with $source }}
|
|
{{ $caption := default .Title $customAlt }}
|
|
|
|
{{ $tiny := (.Resize "320x").RelPermalink }}
|
|
{{ $small := (.Resize "600x").RelPermalink }}
|
|
{{ $medium := (.Resize "1200x").RelPermalink }}
|
|
{{ $large := (.Resize "1800x").RelPermalink }}
|
|
|
|
{{ $size := dict "tiny" $tiny "small" $small "medium" $medium "large" $large }}
|
|
|
|
|
|
<div class="flex justify-center">
|
|
<figure class="gdoc-markdown__figure">
|
|
<a class="gdoc-markdown__link--raw" href="{{ .RelPermalink }}">
|
|
<picture>
|
|
<source
|
|
{{ with $customSize }}
|
|
srcset="{{ index $size $customSize }}"
|
|
{{ else }}
|
|
srcset="{{ $size.small }} 600w, {{ $size.medium }} 1200w" sizes="100vw"
|
|
{{ end }}
|
|
/>
|
|
<img
|
|
{{ if $lazyLoad }}
|
|
loading="lazy"
|
|
{{ end }}
|
|
src="{{ $size.large }}"
|
|
alt="{{ $caption }}"
|
|
/>
|
|
</picture>
|
|
</a>
|
|
{{ with $caption -}}
|
|
<figcaption>
|
|
{{ . }}{{ with $source.Params.credits }}({{ . | $.Page.RenderString }}){{ end }}
|
|
</figcaption>
|
|
{{- end }}
|
|
</figure>
|
|
</div>
|
|
{{ end }}
|