From 2bc54df622f4fa8c2bc94233827fb440a8f75ece Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 13 Jan 2026 16:36:34 +0100 Subject: [PATCH] output: Add TestCanonical integration test --- output/outputFormat_integration_test.go | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 output/outputFormat_integration_test.go diff --git a/output/outputFormat_integration_test.go b/output/outputFormat_integration_test.go new file mode 100644 index 000000000..161ecd9ab --- /dev/null +++ b/output/outputFormat_integration_test.go @@ -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: /.") +} -- 2.39.5