HishHash
HishHash

Reputation: 167

Can I have <loc> element & <sitemapindex> element within the same XML for Sitemap?

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 
  xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" 
  xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
  <url>
    <loc>http://www.example.com/foo.html</loc>
  </url>
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      <loc>http://www.example.com/sitemap1.xml.gz</loc>
      <lastmod>2004-10-01T18:23:17+00:00</lastmod>
   </sitemap>
   <sitemap>
      <loc>http://www.example.com/sitemap2.xml.gz</loc>
      <lastmod>2005-01-01</lastmod>
   </sitemap>
   </sitemapindex>
</urlset>

Can I have the url and sitemapindex within the same sitemap XML file? I have around 300K plus pages in the website. Also there are close to 50 static HTML pages. So I want to add these static URLs directly under the url tag and for dynamic URLs I create a sitemap index.

Upvotes: 1

Views: 833

Answers (1)

methode
methode

Reputation: 5438

No, that will not work. In Search Console (former Webmaster Tools) you will get an "Unexpected tag" error message and the sitemap will be dropped.

Your best bet is to create a separate sitemap for those 50 HTML pages, and then include that sitemap in your sitemap index file.

Upvotes: 2

Related Questions