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
ju52
August 31, 2019, 3:11pm
2
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
ju52
August 31, 2019, 3:51pm
4
You can try to change the config
[outputs]
section = [ âHTMLâ , âSITEMAPâ]
to generate sitemaps per section
1 Like
ju52
August 31, 2019, 4:03pm
5
more info
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
1 Like
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 â
ju52
September 25, 2019, 8:32am
7
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
You did replied the same in other comments.
Pain in the $$$ ?
break it down by sections
my templates from layouts/_default
home.sitemap.html
{{ print "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" | safeHTML }}
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">{{ range (where site.Sections "Section" "not in" site.Params.invisibleSections) }}
<sitemap>
<loc>{{ .Permalink }}sitemap.xml</loc>
</sitemap>{{end}}
</sitemapindex>
section.sitemap.html
{{ print "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" | safeHâŚ