diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-04-11 17:46:18 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-04-15 09:49:57 +0200 |
commit | df11327ba90179747be2b25574ac48c2f336b298 (patch) | |
tree | 70f7487cee6815109fc325ed0619130bb29834ca /resources | |
parent | a18e2bcb9a2c556e03dc7e790b0343c83163877a (diff) | |
download | hugo-df11327ba90179747be2b25574ac48c2f336b298.tar.gz hugo-df11327ba90179747be2b25574ac48c2f336b298.zip |
Pass .RenderShortcodes' Page to render hooks as .PageInner
The main use case for this is to resolve links and resources (e.g. images) relative to the included `Page`.
A typical `include` would similar to this:
```handlebars
{{ with site.GetPage (.Get 0) }}
{{ .RenderShortcodes }}
{{ end }}
```
And when used in a Markdown file:
```markdown
{{% include "/posts/p1" %}}
```
Any render hook triggered while rendering `/posts/p1` will get `/posts/p1` when calling `.PageInner`.
Note that
* This is only relevant for shortcodes included with `{{%` that calls `.RenderShortcodes`.
* `.PageInner` is available in all render hooks that, before this commit, received `.Page`.
* `.PageInner` will fall back to the value of `.Page` if not relevant and will always have a value.
Fixes #12356
Diffstat (limited to 'resources')
-rw-r--r-- | resources/page/pagemeta/page_frontmatter.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/resources/page/pagemeta/page_frontmatter.go b/resources/page/pagemeta/page_frontmatter.go index 4e412c666..123dd4b70 100644 --- a/resources/page/pagemeta/page_frontmatter.go +++ b/resources/page/pagemeta/page_frontmatter.go @@ -88,6 +88,9 @@ type PageConfig struct { // User defined params. Params maps.Params + + // Compiled values. + IsGoldmark bool `json:"-"` } // FrontMatterHandler maps front matter into Page fields and .Params. |