Skip to content

Commit

Permalink
tpl/tplimpl: Use https in sitemap templates
Browse files Browse the repository at this point in the history
Closes #10515
  • Loading branch information
jmooring authored and bep committed Dec 11, 2022
1 parent e0e63f3 commit 3fd0b78
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hugolib/minify_publisher_test.go
Expand Up @@ -59,5 +59,5 @@ func TestMinifyPublisher(t *testing.T) {
b.AssertFileContent("public/index.xml", "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\"><channel><title/><link>https://example.org/</link>")

// Sitemap
b.AssertFileContent("public/sitemap.xml", "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"><url><loc>h")
b.AssertFileContent("public/sitemap.xml", "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><urlset xmlns=\"https://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"https://www.w3.org/1999/xhtml\"><url><loc>h")
}
4 changes: 2 additions & 2 deletions tpl/tplimpl/embedded/templates/_default/sitemap.xml
@@ -1,6 +1,6 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="https://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
{{- if .Permalink -}}
<url>
Expand Down
2 changes: 1 addition & 1 deletion tpl/tplimpl/embedded/templates/_default/sitemapindex.xml
@@ -1,5 +1,5 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemapindex xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
{{ range . }}
<sitemap>
<loc>{{ .SitemapAbsURL }}</loc>
Expand Down

1 comment on commit 3fd0b78

@McShelby
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A XML namespace is usually not meant for browsing. The expected value should be using an http:// prefix as mentioned in the docs.

Switching may result in unexpected behaviour (eg. tools that consume those XML files may have trouble with this).

Please sign in to comment.