mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
b8ab5c9be6
commit
e75784930d
2 changed files with 26 additions and 1 deletions
|
@ -123,3 +123,28 @@ func TestParseSitemap(t *testing.T) {
|
||||||
t.Errorf("Got \n%v expected \n%v", result, expected)
|
t.Errorf("Got \n%v expected \n%v", result, expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSitemapShouldNotUseListXML(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
baseURL = "https://example.com"
|
||||||
|
disableKinds = ["term", "taxonomy"]
|
||||||
|
[languages]
|
||||||
|
[languages.en]
|
||||||
|
weight = 1
|
||||||
|
languageName = "English"
|
||||||
|
[languages.nn]
|
||||||
|
weight = 2
|
||||||
|
-- layouts/_default/list.xml --
|
||||||
|
Site: {{ .Site.Title }}|
|
||||||
|
-- layouts/home --
|
||||||
|
Home.
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
|
b := Test(t, files)
|
||||||
|
|
||||||
|
b.AssertFileContent("public/sitemap.xml", "https://example.com/en/sitemap.xml")
|
||||||
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ type LayoutDescriptor struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d LayoutDescriptor) isList() bool {
|
func (d LayoutDescriptor) isList() bool {
|
||||||
return !d.RenderingHook && d.Kind != "page" && d.Kind != "404"
|
return !d.RenderingHook && d.Kind != "page" && d.Kind != "404" && d.Kind != "sitemap" && d.Kind != "sitemapindex"
|
||||||
}
|
}
|
||||||
|
|
||||||
// LayoutHandler calculates the layout template to use to render a given output type.
|
// LayoutHandler calculates the layout template to use to render a given output type.
|
||||||
|
|
Loading…
Reference in a new issue