.Site vs site - any performance advantages of either?

I understand, that .Site.something is a variable that contains the site information when the layout is loaded/parsed, and site.something is a function that gets the site information of the current page. In my mind (Homer Simpson once said he is afraid to learn new stuff because he might forget how to drink beer or something like that. this.) This means, that if I want to access site variables I will do it via site.something.

Are there any performance implications if I use only site.something because Hugo needs to do an extra step or is the variable already available and is just returned this way? Or do I miss something completely magical that is available via only either or other?

The way I understand it is:

  • Functionally, they both return Site Variables, i.e. the list here:
  • However, site is not bound to the . context, whereas .Site is. Meaning if you pass a dict to a partial, your partial might lose the .Site context (unless you explicitly pass it on), but you will always be able to use site to do so.

Personally, I use site, just so I don’t have to think about it.

Edit to add: (slightly off-topic)

I was looking for the release notes for when site was introduced:

site is almost 2 year old now. I feel old. :laughing: