Sitemap.xml not generated in root of multilingual site

Hi,
I have several languages but have problem to generate sitemapindex.xml, after hugo there is not a file sitemapindex.xml in public folder.
I even tried to put file sitemapindex.xml to layouts and then to layouts/_default but nothing happened.
Where it could be the problem?

Which free theme from themes generate this file? I tried few but those also don’t generate.

sitemap.xml are generated correctly in every language directory in public folder.

The sitemap URL should be sitemap.xml by default, i.e. http://localhost:1313/sitemap.xml.
Could you please confirm if there is a sitemap.xml in the public folder?

Please check whether the site disable the sitemap as well.

disableKinds:
- sitemap

See Sitemap Templates | Hugo for details.

I have a problem with sitemapINDEX.xml, not “regular” sitemap.xml, as I said sitemap.xml are generated correctly :wink:

I read Sitemap Templates | Hugo and try tips from there but still don’t generate :frowning:

1 Like

I think the sitemap.xml is what you’re looking for, it is the index sitemap.
The sitemap of the default language is placed under corresponding language folder, i.e. public/en/sitemap.xml.

$ curl http://localhost:1313/sitemap.xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>http://localhost:1313/en/sitemap.xml</loc>
      <lastmod>2023-02-24T12:52:47+08:00</lastmod> 
  </sitemap>
  <sitemap>
    <loc>http://localhost:1313/zh-hans/sitemap.xml</loc>
      <lastmod>2023-02-18T10:42:27+08:00</lastmod>
  </sitemap>
  <sitemap>
    <loc>http://localhost:1313/ar/sitemap.xml</loc>
  </sitemap>
</sitemapindex>

There are difference between sitemap.xml and sitemapindex.xml - you can reab about here

I know that and as I said - sitemap.xml is ok, I have problem to generate sitemapINDEX.xml

Hmm, after reading the specification, I’m sure that the public/sitemap.xml is the sitemap index file, which in form:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>http://localhost:1313/en/sitemap.xml</loc>
      <lastmod>2023-02-24T12:52:47+08:00</lastmod> 
  </sitemap>
  <sitemap>
    <loc>http://localhost:1313/zh-hans/sitemap.xml</loc>
      <lastmod>2023-02-18T10:42:27+08:00</lastmod>
  </sitemap>
  <sitemap>
    <loc>http://localhost:1313/ar/sitemap.xml</loc>
  </sitemap>
</sitemapindex>
URL Description
public/sitemap.xml The sitemap index file groups all language’s sitemap.
public/en/sitemap.xml The regular sitemap for en site.
public/zh-hans/sitemap.xml The regular sitemap for zh-hans site.

You’re able to create a different sitemap index file by Creating a resource from template

unfortunately after command hugo its generate in public directory for every language as en, de, es etc but don’t generate any other file (such as sitemapindex.xml) - i don’t know how to fix it

“sitemapindex.xml” is the name of the template that generates the “sitemap.xml” file in the root of a multilingual site.

public/
├── de/
│   ├── index.html
│   └── sitemap.xml  <-- generated by sitemap.xml template
├── en/
│   ├── index.html
│   └── sitemap.xml  <-- generated by sitemap.xml template
├── favicon.ico
├── index.html
└── sitemap.xml  <-- generated by sitemapindex.xml template

Open the sitemap.xml file in the root of your public folder and you will see:

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

That’s the case. Command hugo don’t generate sitemap.xml in the root of public directory.
In directories “en”, “de” (and every other language) i have like on the screen. I can’t find a reason why.

@jmooring do you know any hugo theme where it generated? I would check whats the reason

Yes, every theme.

I suggest you share your project repository.

1 Like