From 66a0603ca564a2d056998d43bc39604a0e895c42 Mon Sep 17 00:00:00 2001 From: blackb1rd Date: Sat, 10 Oct 2020 21:48:19 +0700 Subject: [PATCH 1/2] hugolib: Fix Output format (AMP) render hooks is not map correctly --- hugolib/content_map_page.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index b32f808c971..f2d9d348153 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -22,6 +22,7 @@ import ( "sync" "github.com/gohugoio/hugo/common/maps" + "github.com/gohugoio/hugo/output" "github.com/gohugoio/hugo/common/types" "github.com/gohugoio/hugo/resources" @@ -199,7 +200,7 @@ func (m *pageMap) newPageFromContentNode(n *contentNode, parentBucket *pagesMapB // Create a content provider for the first, // we may be able to reuse it. - if i == 0 { + if po.f.Name == output.HTMLFormat.Name || po.f.Name == output.AMPFormat.Name { contentProvider, err := newPageContentOutput(ps, po) if err != nil { return nil, err From 8d0a8ab714c2726fb9c10066fbc26bf97750d2b8 Mon Sep 17 00:00:00 2001 From: blackb1rd Date: Sun, 11 Oct 2020 22:34:00 +0700 Subject: [PATCH 2/2] hugolib: Fix Custom Output format render hooks is not map correctly --- hugolib/content_map_page.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index f2d9d348153..4c85a3a7e26 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -22,7 +22,6 @@ import ( "sync" "github.com/gohugoio/hugo/common/maps" - "github.com/gohugoio/hugo/output" "github.com/gohugoio/hugo/common/types" "github.com/gohugoio/hugo/resources" @@ -200,13 +199,11 @@ func (m *pageMap) newPageFromContentNode(n *contentNode, parentBucket *pagesMapB // Create a content provider for the first, // we may be able to reuse it. - if po.f.Name == output.HTMLFormat.Name || po.f.Name == output.AMPFormat.Name { - contentProvider, err := newPageContentOutput(ps, po) - if err != nil { - return nil, err - } - po.initContentProvider(contentProvider) + contentProvider, err := newPageContentOutput(ps, po) + if err != nil { + return nil, err } + po.initContentProvider(contentProvider) ps.pageOutputs[i] = po created[f.Name] = po