Pages should do recursive search for image files
AnnMarieW opened this issue · comments
When creating meta tags, Pages only searches the root of the assets folder for image files. It would be better to do a recursive search since it's common to use folders within /assets
in larger projects.
This would still be consistent with the docs which states:
The image value must be the name of a file inside the assets folder.
If you don't specify image, Pages checks for an image that meets one of these criteria (in order) and uses the first one it finds....
Currently it's necessary to specify the image file name ie image="images/app.png"
when using subfolder in /assets
. This change would make that step unnecessary.
I could do the PR to fix this if you like 🙂
For completeness here's the full docstring you're referring to:
Lines 246 to 253 in f70b3db
Walking the whole assets dir is certainly easy for users, I'm just trying to figure out how likely it is it'll lead to ambiguity or unintended effects... like since app.<extension>
and logo.<extension>
are pretty generic, what if deep in some subdir there's an app.jpg
that you didn't really mean to use for this purpose? For example you add a folder of a million icons that you want to use a couple of in your layout, like bootstrap icons https://icons.getbootstrap.com/icons/app/
I don't know how many people would hit that, but it could be very confusing if it did happen. As a safer (but less user-friendly) alternative we could make a global setting "look in this assets subfolder for pages images" perhaps with an option like "*"
to walk the whole dir?
I can see how this could lead to some unexpected results. It’s certainly possible to limit the search to certain folders, but I think it would add complexity rather than reduce it — which was the goal.
It’s probably best to close this issue, and it could be reopened later if people think it’s worthwhile.