If the current context[1] is a Page
, you can use .Site
.
If the current context is not a Page
and the template context[2] is a Page
, you can use $.Site
. The $
gets you to the template context.
If neither the current context nor the template context include a Page
, use the global site
function. For example, inside of a partial that receives a slice of integers.
https://gohugo.io/templates/introduction/