| 1 |
package output_test |
| 2 |
|
| 3 |
import ( |
| 4 |
"testing" |
| 5 |
|
| 6 |
"github.com/gohugoio/hugo/hugolib" |
| 7 |
) |
| 8 |
|
| 9 |
func TestCanonical(t *testing.T) { |
| 10 |
t.Parallel() |
| 11 |
|
| 12 |
files := ` |
| 13 |
-- hugo.toml -- |
| 14 |
[outputs] |
| 15 |
home = ["notcanonical", "html", "rss"] |
| 16 |
|
| 17 |
[outputFormats] |
| 18 |
[outputFormats.notcanonical] |
| 19 |
mediaType = 'text/html' |
| 20 |
path = 'not' |
| 21 |
isHTML = true |
| 22 |
-- layouts/all.html -- |
| 23 |
All. Canonical: {{ .OutputFormats.Canonical.RelPermalink }}. |
| 24 |
` |
| 25 |
|
| 26 |
b := hugolib.Test(t, files) |
| 27 |
|
| 28 |
b.AssertFileContent("public/not/index.html", "All. Canonical: /.") |
| 29 |
b.AssertFileContent("public/index.html", "All. Canonical: /.") |
| 30 |
} |