Files
Kirik da5b40d168 Mobile: center pinned post, pagination fixes, minor layout tweaks
- First (pinned) post on mobile: title and image centered
- Pagination: restored page counter on mobile, buttons above footer
- Typography and layout minor improvements

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 00:50:35 +01:00

47 lines
2.2 KiB
HTML
Executable File

<!--
Updated figure shortcode for S3 images
NB this overrides Hugo's built-in "figure" shortcode but is backwards compatible
-->
<!-- count how many times we've called this shortcode; load the css if it's the first time -->
{{- if not ($.Page.Scratch.Get "figurecount") }}<link rel="stylesheet" href="{{ "css/hugo-easy-gallery.css" | relURL }}?v={{ now.Unix }}&update=2" />{{ end }}
{{- $.Page.Scratch.Add "figurecount" 1 -}}
<!-- use either src or link-thumb for thumbnail image -->
{{- $thumb := .Get "src" | default (printf "%s." (.Get "thumb") | replace (.Get "link") ".") }}
<!-- Check if image URL is already absolute (starts with http/https) -->
{{- $thumbURL := "" }}
{{- if or (hasPrefix $thumb "http://") (hasPrefix $thumb "https://") }}
{{- $thumbURL = $thumb }}
{{- else }}
{{- $thumbURL = $thumb | relURL }}
{{- end }}
{{- $linkURL := "" }}
{{- $link := .Get "link" | default (.Get "src") }}
{{- if or (hasPrefix $link "http://") (hasPrefix $link "https://") }}
{{- $linkURL = $link }}
{{- else }}
{{- $linkURL = $link | relURL }}
{{- end }}
<div class="box{{ with .Get "caption-position" }} fancy-figure caption-position-{{.}}{{end}}{{ with .Get "caption-effect" }} caption-effect-{{.}}{{end}}" {{ with .Get "width" }}style="max-width:{{.}}"{{end}}>
<figure {{ with .Get "class" }}class="{{.}}"{{ end }} itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<div class="img"{{ if .Parent }} data-bg="url('{{ $thumbURL }}')"{{ end }}{{ with .Get "size" }} data-size="{{.}}"{{ end }}>
<img itemprop="thumbnail" src="{{ $thumbURL }}" loading="lazy" {{ with .Get "alt" | default (.Get "caption") }}alt="{{.}}"{{ end }}/><!-- <img> hidden if in .gallery -->
</div>
{{ with $linkURL }}<a href="{{ . }}" itemprop="contentUrl"></a>{{ end }}
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>
{{- with .Get "title" }}<h4>{{.}}</h4>{{ end }}
{{- if or (.Get "caption") (.Get "attr")}}
<p>
{{- .Get "caption" -}}
{{- with .Get "attrlink"}}<a href="{{.}}">{{ .Get "attr" }}</a>{{ else }}{{ .Get "attr"}}{{ end -}}
</p>
{{- end }}
</figcaption>
{{- end }}
</figure>
</div>