Hugo

Sitemap exceeds the maximum file size limit

I am new to hugo.

After submit my sitemap on google (https://www.crete-news.gr/index.xml) I got an error: > Your Sitemap exceeds the maximum file size limit. Please create multiple Sitemaps containing fewer URLs to meet the file size limit.

Is there any way with hugo to build multiple sitemap with sitemapindex like i did there: https://manage.crete-news.gr/sitemap/articles/sitemap_index.xml

you can make own sitemaps

I would only insert site.RegularPages in the sitemap. SEO does not need the taxonomy and paging pages.

Start ev. with sitemaps per section, generate the sitemap_index manually or with a template over the sections.

ok thank you I will try it

You can try to change the config

[outputs]
section = [ “HTML” , “SITEMAP”]

to generate sitemaps per section

more info :wink:
layout/_default/section.sitemap.xml

<urlset xmlns="http://wwwsitemaps.org/schemassitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .CurrentSection.RegularPages -}}
<url>
 <loc>{{ .Permalink }}</loc>
 {{ if not .Lastmod.IsZero }}<lastmod>{{ safeHTML ( .Lastmod.Format site.Params.dateFormatFeed ) }}</lastmod>{{ end }}
 {{ with .Sitemap.ChangeFreq }}<changefreq>{{ . }}</changefreq>{{ end }}
 {{ if ge .Sitemap.Priority 0.0 }}<priority>{{ .Sitemap.Priority }}</priority>{{ end }}
</url>
{{- end }}
</urlset>

add in config

[outputFormats.SITEMAP]
    MediaType             = "application/atom+xml"
    BaseName              = "sitemap"
    suffix                = "xml"
    IsHTML                = false
    IsPlainText           = false
    noUgly                = true
    Rel                   = "alternate"

have a nice weekend

There is a typo I guess in the code…

MediaType is “application/rss+xml”

By changing the code, it worked for me.

[outputFormats.SITEMAP]
    MediaType             = "application/rss+xml"
    BaseName              = "sitemap"
    suffix                = "xml"
    IsHTML                = false
    IsPlainText           = false
    noUgly                = true
    Rel                   = "alternate"

Or else, I ll get the error

Error: error decoding ‘’: media type “application/atom+xml” not found

— 8.11212301254 seconds —

thanks for the hint

The correct MediaType should selected with information from https://tools.ietf.org/html/rfc3023
I don’t know what Google likes to see.

Best guess is

MediaType = "application/xml"

PS: I was all too fast with cut & paste
PS2: hugo doesn’t like text/xml

1 Like

Yeah, it is "application/xml :slight_smile:

You did replied the same in other comments.