Back to Hugo

reflect.IsImageResourceWithMeta

docs/content/en/functions/reflect/IsImageResourceWithMeta.md

0.161.1578 B
Original Source

{{< new-in 0.157.0 />}}

Usage

This example iterates through all project resources and uses reflect.IsImageResourceWithMeta to safely display image dimensions and metadata only for supported formats.

go-html-template
{{ range resources.Match "**" }}
  {{ if reflect.IsImageResourceWithMeta . }}
    
    {{ with .Meta }}
      <p>Taken on: {{ .Date }}</p>
    {{ end }}
  {{ end }}
{{ end }}

{{% include "/_common/functions/reflect/image-reflection-functions.md" %}}