Address all warnings during the Hugo build

- Add descriptions for pages that have too much content
- Add an image orientation override param so that I can specify orientation when it's missing from EXIF
- Move the author.name and author.email configurations to params; delete author.yaml
This commit is contained in:
Eryn Wells 2023-12-18 11:22:14 -08:00
parent e4c62f02d3
commit 383234e983
13 changed files with 41 additions and 16 deletions

View file

@ -1,18 +1,30 @@
{{ $orientation := 0 }}
{{ with (int .Exif.Tags.Orientation) }}
{{/* EXIF orientation is specified as an integer corresponding to a 90º rotation. */}}
{{ if in (slice 1 2) . }}
{{ with .Params.orientation }}
{{ if strings.Contains . "horizontal" }}
{{ $orientation = 0 }}
{{ else if in (slice 3 4) . }}
{{ else if strings.Contains . "rotate180" }}
{{ $orientation = 180 }}
{{ else if in (slice 5 6) . }}
{{ else if strings.Contains . "rotate90" }}
{{ $orientation = 90 }}
{{ else if in (slice 7 8) . }}
{{ else if strings.Contains . "rotate270" }}
{{ $orientation = 270 }}
{{ end }}
{{ else }}
{{ warnf "Image missing orientation: %s" . }}
{{ with (int .Exif.Tags.Orientation) }}
{{/* EXIF orientation is specified as an integer corresponding to a 90º rotation. */}}
{{ if in (slice 1 2) . }}
{{ $orientation = 0 }}
{{ else if in (slice 3 4) . }}
{{ $orientation = 180 }}
{{ else if in (slice 5 6) . }}
{{ $orientation = 90 }}
{{ else if in (slice 7 8) . }}
{{ $orientation = 270 }}
{{ end }}
{{ else }}
{{ warnf "Image missing orientation: %s" . }}
{{ end }}
{{ end }}
{{ return $orientation }}

View file

@ -8,9 +8,9 @@
{{/* Space separated list of classes to apply to the <img> tag */}}
{{ $classes := .Get "class" }}
{{ $altText := $img.Params.alt | default (.Get "alt") }}
{{ $altText := .Get "alt" | default $img.Params.alt }}
{{ if not $altText }}
{{ warnf "Image doesn't have alt text. %s" $img.Permalink }}
{{ warnf "Image doesn't have alt text: %s" $img.RelPermalink }}
{{ end }}
{{ $resizedImg := $img.Fit "1280x1280" }}