.Site vs site - any performance advantages of either?

The way I understand it is:

  • Functionally, they both return Site Variables, i.e. the list here: https://gohugo.io/variables/site/
  • 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: https://gohugo.io/news/0.53-relnotes/

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

7 Likes