Parameterize the photo grid

This commit is contained in:
Eryn Wells 2023-10-03 08:55:13 -07:00
parent 864c1b673a
commit 8cc207b84c
8 changed files with 30 additions and 10 deletions

View file

@ -1,5 +1,4 @@
{{ $stylesheets := slice (resources.Get "styles/root.css")
(resources.Get "styles/railroad.css")
{{ $stylesheets := slice (resources.Get "styles/railroad.css")
(resources.Get "styles/monokai.css")
| append (resources.Match "styles/root/*.css" | sort) }}
{{ if not hugo.IsProduction }}

View file

@ -1,6 +1,13 @@
{{- $thumbnail := partial "photos/thumbnail.html" (dict "Page" . "Width" 600 "Height" 600) -}}
{{- $thumbnail = $thumbnail.Crop "600x600" -}}
{{- $gridSize := $.Site.Params.photos.thumbnailSize -}}
{{- $thumbnail := partial "photos/thumbnail.html" (dict "Page" . "Width" $gridSize "Height" $gridSize) -}}
{{- $thumbnail = $thumbnail.Crop (printf "%dx%d" $gridSize $gridSize) -}}
{{- $altText := $thumbnail.Params.alt -}}
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
<img src="{{ $thumbnail.RelPermalink }}"{{ with $altText }} alt="{{ . }}"{{ end }}>
<img
src="{{ $thumbnail.RelPermalink }}"
{{ with $altText }}
alt="{{ . }}"
{{ end }}
width={{ $gridSize }}
height={{ $gridSize }}>
</a>

View file

@ -11,7 +11,12 @@
{{ if eq (len $photos) 1 }}
{{- $img := index $photos 0 -}}
<figure>
<img src="{{ $img.RelPermalink }}"{{ with $img.Params.alt }} alt="{{ . }}"{{ end }}>
<img
src="{{ $img.RelPermalink }}"
{{ with $img.Params.alt }}
alt="{{ . }}"
{{ end }}
height={{ $img.Height }}>
</figure>
<article>