Resources vs. .Resources (ByType)

Is there any way to get all images using global resources? resources.ByType “image” is not working, only per page .Resources.ByType “image”

For built-in searching, you’re restricted to resources.Match/GetMatch/Get (which if you know your image extensions should get you very far; Hugo’s pattern syntax is pretty powerful).

You can do a match for “**” and do filtering in the template, but that would be ineffective.

what pattern would match all images?

“**.{png,jpg}” should work I think and cover most …

The rules are mostly these http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm + super asterisk.

Also see https://github.com/gobwas/glob

5 Likes

aha, ive been trying regex like jpg|png and similar. thank you so much.