photo.html 1.0 KB

123456789101112131415161718192021222324252627282930
  1. {{ $src := .Get "src"}}
  2. {{ $image := (.Page.Resources.ByType "image").GetMatch (printf "**%s**" $src) -}}
  3. <figure class="big">
  4. <img src="{{$src}}" loading="lazy"
  5. {{- if or (.Get "alt") (.Get "caption") }}
  6. alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
  7. {{- end -}}
  8. {{- with $image.Width }} width="{{ . }}"{{ end -}}
  9. {{- with $image.Height }} height="{{ . }}"{{ end -}}
  10. /><!-- Closing img tag -->
  11. <figcaption>
  12. {{- with (.Get "title") -}}
  13. <h4>{{ . }}</h4>
  14. {{ end -}}
  15. {{ if or (.Get "caption") $image.Exif -}}
  16. <p>
  17. {{- .Get "caption" | markdownify -}}
  18. {{ with $image.Exif -}}
  19. <span class="image_meta">
  20. {{ with .Tags.Model }}{{.}} {{ end -}}
  21. {{ with .Tags.FocalLength }}@ {{.}}mm {{ end -}}
  22. {{ with .Tags.FNumber }}&mdash; &fnof;/{{.}}{{ end -}}
  23. {{ with .Tags.ExposureTime }}, {{ lang.FormatNumber 2 . }} sec{{ end -}}
  24. {{ with .Tags.ISOSpeedRatings }}, ISO {{.}} {{ end }}
  25. </span>
  26. {{ end -}}
  27. </p>
  28. {{ end -}}
  29. </figcaption>
  30. </figure>