aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/sitemap_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-05-02 09:54:26 +0200
committerBjørn Erik Pedersen <[email protected]>2019-05-02 14:23:16 +0200
commit6b76841b052b97625b8995f326d758b89f5c2349 (patch)
tree0a29c666b6e11e6c73f64da4beb0ca86d3965da5 /hugolib/sitemap_test.go
parentbcbed4ebdaf55b67abc521d69bba456c041a7e7d (diff)
downloadhugo-6b76841b052b97625b8995f326d758b89f5c2349.tar.gz
hugo-6b76841b052b97625b8995f326d758b89f5c2349.zip
output: Fix permalink in sitemap etc. when multiple permalinkable output formats
In Hugo 0.55.0 we made AMP `permalinkable`. We also render the output formats in their natural sort order, meaning `AMP` will be rendered before `HTML`. References in the sitemap would then point to the AMP version, and this is normally not what you'd want. This commit fixes that by making `HTML` by default sort before the others. If this is not you want, you can set `weight` on the output format configuration. Fixes #5910
Diffstat (limited to 'hugolib/sitemap_test.go')
-rw-r--r--hugolib/sitemap_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/hugolib/sitemap_test.go b/hugolib/sitemap_test.go
index cab13d356..5aba6f09d 100644
--- a/hugolib/sitemap_test.go
+++ b/hugolib/sitemap_test.go
@@ -100,3 +100,22 @@ func TestParseSitemap(t *testing.T) {
}
}
+
+// https://github.com/gohugoio/hugo/issues/5910
+func TestSitemapOutputFormats(t *testing.T) {
+
+ b := newTestSitesBuilder(t).WithSimpleConfigFile()
+
+ b.WithContent("blog/html-amp.md", `
+---
+Title: AMP and HTML
+outputs: [ "html", "amp" ]
+---
+
+`)
+
+ b.Build(BuildCfg{})
+
+ // Should link to the HTML version.
+ b.AssertFileContent("public/sitemap.xml", " <loc>http://example.com/blog/html-amp/</loc>")
+}