docs/content/en/_common/render-hooks/pageinner.md
The primary use case for PageInner is to resolve links and page resources relative to an included Page. For example, create an "include" shortcode to compose a page from multiple content files, while preserving a global context for footnotes and the table of contents:
{{ with .Get 0 }}
{{ with $.Page.GetPage . }}
{{- .RenderShortcodes }}
{{ else }}
{{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
{{ end }}
{{ else }}
{{ errorf "The %q shortcode requires a positional parameter indicating the logical path of the file to include. See %s" .Name .Position }}
{{ end }}
Then call the shortcode in your Markdown:
{{%/* include "/posts/post-2" */%}}
Any render hook triggered while rendering /posts/post-2 will get:
/posts/post-1 when calling Page/posts/post-2 when calling PageInnerPageInner falls back to the value of Page if not relevant, and always returns a value.
[!note] The
PageInnermethod is only relevant for shortcodes that invoke theRenderShortcodesmethod, and you must call the shortcode using Markdown notation.
As a practical example, Hugo's embedded link and image render hooks use the PageInner method to resolve markdown link and image destinations. See the source code for each: