hugoDocs icon indicating copy to clipboard operation
hugoDocs copied to clipboard

Clarify the distinction between resources and .Resources

Open PaulSD opened this issue 4 years ago • 5 comments

I've seen a number of references/comments that mix up resources.Get and .Resources.GetMatch (for example: https://discourse.gohugo.io/t/data-files-in-the-page-bundle/19284/2). This leads to confusion (for example: https://discourse.gohugo.io/t/what-am-i-not-getting-about-resources-get/33517).

Ideally, resources would have a different name (like assets) to eliminate some of the ambiguity with .Resources. However, since it is probably too late to change the name now, the next best thing would be to have the docs more explicitly distinguish between these.

This PR attempts to clarify the distinction between these in the documentation.

PaulSD avatar Oct 17 '21 17:10 PaulSD

I think that "global" is probably a better descriptor:

  • Global resource vs page resource
  • Global asset vs page asset

jmooring avatar Oct 17 '21 17:10 jmooring

Ok. I've updated my PR to use "global assets" instead of "asset resources".

Is there currently such a thing as a global resource or a page asset? I had thought there were only page resources and global assets...

PaulSD avatar Oct 17 '21 17:10 PaulSD

I agree about the global discussion, but I think an important distinction that I suspect is missing in all of this is that these two resource collections have very much different content.

  • site and .Site is global vs. page, but they point to the same object
  • resources and .Resources are two different collections.

bep avatar Oct 17 '21 17:10 bep

Yeah, that is actually most of what I changed in this PR - explicitly pointing out in the docs that resources and .Resources are different things. :)

PaulSD avatar Oct 17 '21 18:10 PaulSD

I would love to see this merged in. I'm currently struggling with exactly this distinction.

lschierer avatar Jan 10 '22 19:01 lschierer

This will be addressed in https://github.com/gohugoio/hugoDocs/issues/2307

jmooring avatar Nov 07 '23 17:11 jmooring