Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageResources: Unclear wording and inconsistent examples #1487

Closed
chrillek opened this issue Jul 7, 2021 · 1 comment
Closed

PageResources: Unclear wording and inconsistent examples #1487

chrillek opened this issue Jul 7, 2021 · 1 comment

Comments

@chrillek
Copy link

chrillek commented Jul 7, 2021

Re https://gohugo.io/content-management/page-resources/#readout

Under the heading “Methods/byType” it says that resources.byType "image" returns all images in a page bundle. If that is to mean that the images from the image directory in the example configuration at the start of this page are returned, it would be helpful to explicitly state that, I think. Something like “This will return images/a.jpg, images/b.jpgandimages/c.jpg

The next section (“Match”) uses the sample code resource.Match ("images/*). If this does indeed return exactly the same entries as the example before under “byType”, the documentation should say so. Also, this section (“Match”) says that the result is returned as a slice. This detail is missing from the “byType” section. It would make things clearer if this fact would be either mentioned once unter the “Methods” heading or for every method where it is appropriate (and of course explicitly stating what the other methods do return instead).

In fact, I’d suggest to explicitly state that all methods return a special type of data, namely resource(s) that might be processed further with specialized methods like those for images.

Also, the whole section on “Page Resources” starts with a sample directory layout using the images “a/b/c.jpg”. However, the example right under the heading “Pattern Matching” uses some image called “sunset.jpg”. This is unexpected and has no relation to the aforementioned sample layout. To make the whole thing more consistent, I suggest to use images “sunset/sunrise/moonrise.jpg” in the sample layout (and also in the explanations for “byType” and “Matches”). Then one could amend the example under “Pattern Matching” clearer by explicitly stating which images are returned by the working method calls (i.e. those marked with a green checkmark now).
#1491

@jmooring
Copy link
Member

jmooring commented Nov 7, 2023

This will be addressed in #2307

@jmooring jmooring closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants