From 79a022a15c5f39b8ae87a94665f14bf1797b605c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 14 Oct 2020 11:23:24 +0200 Subject: [PATCH 1/5] Render aliases even if render=link Fixes #7832 --- hugolib/content_map.go | 14 ++++++++++++++ hugolib/disableKinds_test.go | 7 ++++++- hugolib/page__paths.go | 2 +- hugolib/site_render.go | 14 +++++++++++--- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/hugolib/content_map.go b/hugolib/content_map.go index 33ef4f8dd99..652609e2626 100644 --- a/hugolib/content_map.go +++ b/hugolib/content_map.go @@ -830,6 +830,13 @@ var ( } return n.p.m.noRender() } + + contentTreeNoLinkFilter = func(s string, n *contentNode) bool { + if n.p == nil { + return true + } + return n.p.m.noLink() + } ) func (c *contentTree) WalkQuery(query pageMapQuery, walkFn contentTreeNodeCallback) { @@ -865,6 +872,13 @@ func (c contentTrees) WalkRenderable(fn contentTreeNodeCallback) { } } +func (c contentTrees) WalkLinkable(fn contentTreeNodeCallback) { + query := pageMapQuery{Filter: contentTreeNoLinkFilter} + for _, tree := range c { + tree.WalkQuery(query, fn) + } +} + func (c contentTrees) Walk(fn contentTreeNodeCallback) { for _, tree := range c { tree.Walk(func(s string, v interface{}) bool { diff --git a/hugolib/disableKinds_test.go b/hugolib/disableKinds_test.go index 381442d692d..73786c730b6 100644 --- a/hugolib/disableKinds_test.go +++ b/hugolib/disableKinds_test.go @@ -58,6 +58,7 @@ _build: "sect/no-render-link.md", ` --- title: No Render Link +aliases: ["/link-alias"] _build: render: link --- @@ -319,10 +320,14 @@ title: Headless Local Lists Sub p := getPage(b, ref) b.Assert(p, qt.Not(qt.IsNil)) b.Assert(p.RelPermalink(), qt.Equals, "/blog/sect/no-render-link/") - b.Assert(p.OutputFormats(), qt.HasLen, 0) + b.Assert(p.OutputFormats(), qt.HasLen, 1) b.Assert(getPageInSitePages(b, ref), qt.Not(qt.IsNil)) sect := getPage(b, "/sect") b.Assert(getPageInPagePages(sect, ref), qt.Not(qt.IsNil)) + + // https://github.com/gohugoio/hugo/issues/7832 + // It should still render any aliases. + b.AssertFileContent("public/link-alias/index.html", "refresh") }) c.Run("Build config, no publish resources", func(c *qt.C) { diff --git a/hugolib/page__paths.go b/hugolib/page__paths.go index 535c60ba0aa..d41b7c2bc04 100644 --- a/hugolib/page__paths.go +++ b/hugolib/page__paths.go @@ -76,7 +76,7 @@ func newPagePaths( } var out page.OutputFormats - if !pm.noRender() { + if !pm.noLink() { out = pageOutputFormats } diff --git a/hugolib/site_render.go b/hugolib/site_render.go index d9d60c2fa3e..7f5bcfb1aa3 100644 --- a/hugolib/site_render.go +++ b/hugolib/site_render.go @@ -323,20 +323,28 @@ func (s *Site) renderRobotsTXT() error { // renderAliases renders shell pages that simply have a redirect in the header. func (s *Site) renderAliases() error { var err error - s.pageMap.pageTrees.WalkRenderable(func(ss string, n *contentNode) bool { + s.pageMap.pageTrees.WalkLinkable(func(ss string, n *contentNode) bool { p := n.p if len(p.Aliases()) == 0 { return false } + pathSeen := make(map[string]bool) + for _, of := range p.OutputFormats() { if !of.Format.IsHTML { - return false + continue } - plink := of.Permalink() f := of.Format + if pathSeen[f.Path] { + continue + } + pathSeen[f.Path] = true + + plink := of.Permalink() + for _, a := range p.Aliases() { isRelative := !strings.HasPrefix(a, "/") From 7487c0abf281bd736f2b2a2b26dac1fb6efc2469 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 14 Oct 2020 15:15:22 +0000 Subject: [PATCH 2/5] releaser: Add release notes for 0.76.5 [ci skip] --- temp/0.76.5-relnotes-ready.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 temp/0.76.5-relnotes-ready.md diff --git a/temp/0.76.5-relnotes-ready.md b/temp/0.76.5-relnotes-ready.md new file mode 100644 index 00000000000..f89720bf89a --- /dev/null +++ b/temp/0.76.5-relnotes-ready.md @@ -0,0 +1,8 @@ + + +This is a bug-fix release with one important fix. + +* Render aliases even if render=link [79a022a1](https://github.com/gohugoio/hugo/commit/79a022a15c5f39b8ae87a94665f14bf1797b605c) [@bep](https://github.com/bep) [#7832](https://github.com/gohugoio/hugo/issues/7832) + + + From dcf70ea5a594b72355cfcc97aabd9102b9b82e9c Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 14 Oct 2020 15:15:22 +0000 Subject: [PATCH 3/5] releaser: Bump versions for release of 0.76.5 [ci skip] --- common/hugo/version_current.go | 2 +- snap/snapcraft.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index c0f55e110b9..eb5906468a8 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -17,6 +17,6 @@ package hugo // This should be the only one. var CurrentVersion = Version{ Number: 0.76, - PatchLevel: 4, + PatchLevel: 5, Suffix: "", } diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index fc5a95df199..f61bd710a23 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: hugo -version: "0.76.4" +version: "0.76.5" summary: Fast and Flexible Static Site Generator description: | Hugo is a static HTML and CSS website generator written in Go. It is From 60f0725b3e827b4ffd384d183ca12322fe036ba4 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 14 Oct 2020 15:15:22 +0000 Subject: [PATCH 4/5] releaser: Add release notes to /docs for release of 0.76.5 [ci skip] --- docs/content/en/news/0.76.5-relnotes/index.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/content/en/news/0.76.5-relnotes/index.md diff --git a/docs/content/en/news/0.76.5-relnotes/index.md b/docs/content/en/news/0.76.5-relnotes/index.md new file mode 100644 index 00000000000..063cbbaa9cd --- /dev/null +++ b/docs/content/en/news/0.76.5-relnotes/index.md @@ -0,0 +1,19 @@ + +--- +date: 2020-10-14 +title: "Hugo 0.76.5: A couple of Bug Fixes" +description: "This version fixes a couple of bugs introduced in 0.76.0." +categories: ["Releases"] +images: +- images/blog/hugo-bug-poster.png + +--- + + + +This is a bug-fix release with one important fix. + +* Render aliases even if render=link [79a022a1](https://github.com/gohugoio/hugo/commit/79a022a15c5f39b8ae87a94665f14bf1797b605c) [@bep](https://github.com/bep) [#7832](https://github.com/gohugoio/hugo/issues/7832) + + + From 2f3f41f736da8b132253cca7d326347f50de6075 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 14 Oct 2020 15:28:16 +0000 Subject: [PATCH 5/5] releaser: Prepare repository for 0.77.0-DEV [ci skip] --- common/hugo/version_current.go | 6 +++--- snap/snapcraft.yaml | 4 ++-- temp/0.76.5-relnotes-ready.md | 8 -------- 3 files changed, 5 insertions(+), 13 deletions(-) delete mode 100644 temp/0.76.5-relnotes-ready.md diff --git a/common/hugo/version_current.go b/common/hugo/version_current.go index eb5906468a8..79151cc24d3 100644 --- a/common/hugo/version_current.go +++ b/common/hugo/version_current.go @@ -16,7 +16,7 @@ package hugo // CurrentVersion represents the current build version. // This should be the only one. var CurrentVersion = Version{ - Number: 0.76, - PatchLevel: 5, - Suffix: "", + Number: 0.77, + PatchLevel: 0, + Suffix: "-DEV", } diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f61bd710a23..d1d73df0474 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,12 +1,12 @@ name: hugo -version: "0.76.5" +version: "0.77.0-DEV" summary: Fast and Flexible Static Site Generator description: | Hugo is a static HTML and CSS website generator written in Go. It is optimized for speed, easy use and configurability. Hugo takes a directory with content and templates and renders them into a full HTML website. confinement: strict -grade: stable # "devel" or "stable" +grade: devel # "devel" or "stable" apps: hugo: diff --git a/temp/0.76.5-relnotes-ready.md b/temp/0.76.5-relnotes-ready.md deleted file mode 100644 index f89720bf89a..00000000000 --- a/temp/0.76.5-relnotes-ready.md +++ /dev/null @@ -1,8 +0,0 @@ - - -This is a bug-fix release with one important fix. - -* Render aliases even if render=link [79a022a1](https://github.com/gohugoio/hugo/commit/79a022a15c5f39b8ae87a94665f14bf1797b605c) [@bep](https://github.com/bep) [#7832](https://github.com/gohugoio/hugo/issues/7832) - - -