HUGO
Menu
GitHub 90272 stars Mastodon

resources.ByType

Returns a collection of global resources of the given media type, or nil if none found.
Syntax
resources.ByType MEDIATYPE
Returns
resource.Resources

The media type is typically one of image, text, audio, video, or application.

{{ range resources.ByType "image" }}
  <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}

This function operates on global resources. For page resources, use the corresponding Resources method on a Page object.