photo.html 975 B

1234567891011121314151617181920212223242526272829
  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>【
  20. {{- with .Tags.FocalLength }}{{.}}mm{{ end -}}
  21. {{ with .Tags.ApertureValue }}, &fnof;/{{ lang.FormatNumber 1 . }}{{ end -}}
  22. {{ with .Tags.ExposureTime }}, {{.}}s{{ end -}}
  23. {{ with .Tags.ISO }}, ISO{{.}}{{ end }}】
  24. </span>
  25. {{ end -}}
  26. </p>
  27. {{ end -}}
  28. </figcaption>
  29. </figure>