#15348·hugo

Add scope information apis

Author: NovaliX-DevCreated Sep 15, 2026Updated Sep 16, 2026
LabelsProposal

Right now the only way to do so is to pass the scope we want to the partials. That's basically prop-drilling, which is bad.

One way to do it would be to use .Page.Store.Set and .Page.Store.Get, but if we're using third party partials, we don't have the guarantee of using the same slot.

That's why i would like to have a way from a partial to get from which page it was called, or at least have a scope to get

Why ?

When we want to issue a warning or an error, we might want to issue the scope along with it, so that authors / developers can determine what's the cause more easily.

Pages are already formatted to give the path, so one might writing this

warnf "%s: ..." $page
errorf "%s: ..." $page

And as i said earlier, we either have to prop drill or using stores which might not be used the same way for third party partials

Syntax proposal

{{ withScope <scope> }}
   ...
{{ end }}
$scope := scope

Scope restrictions

Honestly i'm not sure if that's needed, so we can put anything we want.

Opened questions

  • Should the scope be modifiable ? If not, how to prevent it to be modified ?
  • We already have the . for current context and $ for root context. Should we reconcile the naming convention with scope ?