aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/shortcode_page.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-08-13 15:49:56 +0200
committerBjørn Erik Pedersen <[email protected]>2024-08-29 16:45:21 +0200
commit37609262dcddac6d3358412b10214111b4d4dc3d (patch)
tree60f1370ec79454742c7eb727ca1bb9156aecb296 /hugolib/shortcode_page.go
parent2b5c335e933cbd8e4e8569f206add5ec1bccd8e9 (diff)
downloadhugo-37609262dcddac6d3358412b10214111b4d4dc3d.tar.gz
hugo-37609262dcddac6d3358412b10214111b4d4dc3d.zip
Add Page.Contents with scope support
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types: Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`. Fixes #8680 Fixes #12761 Fixes #12778 Fixes #716
Diffstat (limited to 'hugolib/shortcode_page.go')
-rw-r--r--hugolib/shortcode_page.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/hugolib/shortcode_page.go b/hugolib/shortcode_page.go
index 7c32f2ea1..8030b0285 100644
--- a/hugolib/shortcode_page.go
+++ b/hugolib/shortcode_page.go
@@ -65,6 +65,7 @@ var zeroShortcode = prerenderedShortcode{}
type pageForShortcode struct {
page.PageWithoutContent
page.TableOfContentsProvider
+ page.MarkupProvider
page.ContentProvider
// We need to replace it after we have rendered it, so provide a
@@ -80,6 +81,7 @@ func newPageForShortcode(p *pageState) page.Page {
return &pageForShortcode{
PageWithoutContent: p,
TableOfContentsProvider: p,
+ MarkupProvider: page.NopPage,
ContentProvider: page.NopPage,
toc: template.HTML(tocShortcodePlaceholder),
p: p,
@@ -105,6 +107,7 @@ var _ types.Unwrapper = (*pageForRenderHooks)(nil)
type pageForRenderHooks struct {
page.PageWithoutContent
page.TableOfContentsProvider
+ page.MarkupProvider
page.ContentProvider
p *pageState
}
@@ -112,6 +115,7 @@ type pageForRenderHooks struct {
func newPageForRenderHook(p *pageState) page.Page {
return &pageForRenderHooks{
PageWithoutContent: p,
+ MarkupProvider: page.NopPage,
ContentProvider: page.NopPage,
TableOfContentsProvider: p,
p: p,