Fix server edits of resources included in shortcode/hooks

Fixes #13093
This commit is contained in:
Bjørn Erik Pedersen
2024-11-29 12:13:49 +01:00
parent fc3d1cbadb
commit c1dc35dd71
4 changed files with 86 additions and 21 deletions

View File

@@ -863,6 +863,10 @@ type cachedContentScope struct {
}
func (c *cachedContentScope) prepareContext(ctx context.Context) context.Context {
// A regular page's shortcode etc. may be rendered by e.g. the home page,
// so we need to track any changes to this content's page.
ctx = tpl.Context.DependencyManagerScopedProvider.Set(ctx, c.pco.po.p)
// The markup scope is recursive, so if already set to a non zero value, preserve that value.
if s := hugo.GetMarkupScope(ctx); s != "" || s == c.scope {
return ctx