output: Add TestCanonical integration test

This commit is contained in:
Bjørn Erik Pedersen
2026-01-13 16:36:34 +01:00
parent 608ed09a0a
commit 2bc54df622
+30
View File
@@ -0,0 +1,30 @@
package output_test
import (
"testing"
"github.com/gohugoio/hugo/hugolib"
)
func TestCanonical(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
[outputs]
home = ["notcanonical", "html", "rss"]
[outputFormats]
[outputFormats.notcanonical]
mediaType = 'text/html'
path = 'not'
isHTML = true
-- layouts/all.html --
All. Canonical: {{ .OutputFormats.Canonical.RelPermalink }}.
`
b := hugolib.Test(t, files)
b.AssertFileContent("public/not/index.html", "All. Canonical: /.")
b.AssertFileContent("public/index.html", "All. Canonical: /.")
}