Back to Hugo

reflect.IsResource

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

0.161.11.1 KB
Original Source

{{< new-in 0.154.0 />}}

With this project structure:

text
project/
├── assets/
│   ├── a.json
│   ├── b.avif
│   └── c.jpg
└── content/
    └── example/
        ├── index.md
        ├── d.json
        ├── e.avif
        └── f.jpg

These are the values returned by the reflect.IsResource function:

go-html-template
{{ with resources.Get "a.json" }}
  {{ reflect.IsResource . }} → true
{{ end }}

{{ with resources.Get "b.avif" }}
  {{ reflect.IsResource . }} → true
{{ end }}

{{ with resources.Get "c.jpg" }}
  {{ reflect.IsResource . }} → true
{{ end }}
go-html-template
{{ with .Resources.Get "d.json" }}
  {{ reflect.IsResource . }} → true
{{ end }}

{{ with .Resources.Get "e.avif" }}
  {{ reflect.IsResource . }} → true
{{ end }}

{{ with .Resources.Get "f.jpg" }}
  {{ reflect.IsResource . }} → true
{{ end }}
go-html-template
{{ with site.GetPage "/example" }}
  {{ reflect.IsResource . }} → true
{{ end }}