photo.html 972 B

12345678910111213141516171819202122232425262728
  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. {{ with $image.Exif -}}
  18. <span>【
  19. {{- with .Tags.FocalLength }}{{.}}mm{{ end -}}
  20. {{ with .Tags.ApertureValue }}, &fnof;/{{ lang.FormatNumber 1 . }}{{ end -}}
  21. {{ with .Tags.ExposureTime }}, {{.}}s{{ end -}}
  22. {{ with .Tags.ISO }}, ISO{{.}}{{ end }}】</span>
  23. {{- end -}}
  24. {{- .Get "caption" | markdownify -}}
  25. </p>
  26. {{ end -}}
  27. </figcaption>
  28. </figure>