Repository: gohugoio/hugo (language: go)

Issue:
sitemap should not use list.xml
Tested with hugo v0.124.0-DEV-cf7023cb90f. This was not a problem with v0.122.0.

**The problem occurs with multilingual sites. Monolingual sites are fine.**

```text
layouts/
└── _default/
    ├── baseof.html
    ├── home.html
    ├── list.html
    ├── list.xml   <-- seen as sitemap template instead of rss template
    └── single.html
```

```text
git clone --single-branch -b hugo-forum-topic-48402 https://github.com/jmooring/hugo-testing hugo-forum-topic-48402
cd hugo-forum-topic-48402
hugo
```

> Error: error building site: render: failed to render pages: render of "sitemapindex" failed: "/home/jmooring/code/hugo-testing/layouts/_default/list.xml:1:8": execute of template failed: template: _default/list.xml:1:8: executing "_default/list.xml" at <.Site.Title>: can't evaluate field Site in type []*hugolib.Site

The layouts/_default/list.xml template contains:

```
{{ .Site.Title }}
```

There are no problems if I rename the template to any of the following:

```text
layouts/_default/rss.xml
layouts/_default/list.rss.xml  
layouts/_default/section.xml
```

Reference: <https://discourse.gohugo.io/t/sitemapindex-and-site-title-error-on-list-html/48402>


Discussion / hints:

Fix patch:
diff --git a/output/layouts/layout.go b/output/layouts/layout.go
index b903e09eaed..09606dba1e1 100644
--- a/output/layouts/layout.go
+++ b/output/layouts/layout.go
@@ -50,7 +50,7 @@ type LayoutDescriptor struct {
 }
 
 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.


Test patch:
diff --git a/hugolib/sitemap_test.go b/hugolib/sitemap_test.go
index 6c2cbc5573a..1f869c00063 100644
--- a/hugolib/sitemap_test.go
+++ b/hugolib/sitemap_test.go
@@ -123,3 +123,28 @@ func TestParseSitemap(t *testing.T) {
 		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")
+}