$
is the root context of your template file. Any template file.
From within a partial, from within a layout, from within a Shortcode, $
is the root context.
Because in Go Template, within function like with
, range
and other the context (the dot) is reset to theirs, it is handy to have the root context stored in $
.