aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/page__per_output.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2023-03-05 10:32:00 +0100
committerBjørn Erik Pedersen <[email protected]>2023-03-05 12:51:57 +0100
commitb83050cb40fc11ba36ca2680467fd8d4c6f2e516 (patch)
tree318b1b7edd0ea3d2a97f352c90bb215e46429de7 /hugolib/page__per_output.go
parentdf5608f8a0706c6519f50b5497e36c21b8e790be (diff)
downloadhugo-b83050cb40fc11ba36ca2680467fd8d4c6f2e516.tar.gz
hugo-b83050cb40fc11ba36ca2680467fd8d4c6f2e516.zip
Fix .Fragments when called cross sites on uninitialized output format
Fixes #10794
Diffstat (limited to 'hugolib/page__per_output.go')
-rw-r--r--hugolib/page__per_output.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/hugolib/page__per_output.go b/hugolib/page__per_output.go
index be65ad9e7..3e61a4513 100644
--- a/hugolib/page__per_output.go
+++ b/hugolib/page__per_output.go
@@ -342,6 +342,19 @@ func (p *pageContentOutput) Reset() {
p.renderHooks = &renderHooks{}
}
+func (p *pageContentOutput) Fragments(ctx context.Context) *tableofcontents.Fragments {
+ p.p.s.initInit(ctx, p.initToC, p.p)
+ if p.tableOfContents == nil {
+ return tableofcontents.Empty
+ }
+ return p.tableOfContents
+}
+
+func (p *pageContentOutput) TableOfContents(ctx context.Context) template.HTML {
+ p.p.s.initInit(ctx, p.initToC, p.p)
+ return p.tableOfContentsHTML
+}
+
func (p *pageContentOutput) Content(ctx context.Context) (any, error) {
p.p.s.initInit(ctx, p.initMain, p.p)
return p.content, nil
@@ -380,11 +393,6 @@ func (p *pageContentOutput) Summary(ctx context.Context) template.HTML {
return p.summary
}
-func (p *pageContentOutput) TableOfContents(ctx context.Context) template.HTML {
- p.p.s.initInit(ctx, p.initMain, p.p)
- return p.tableOfContentsHTML
-}
-
func (p *pageContentOutput) Truncated(ctx context.Context) bool {
if p.p.truncated {
return true