How to arrange sitemaps for main site and for blog (in subdomain)
I've got two websites: the main site and a blog that has posts that relate closely to the content of the main site. The blog is in the subdomain "blog."
Content on the main site doesn't change that often, but content on the blog changes weekly. The blog is just a Wordpress site and capable of generating it's own sitemap.
I'm struggling to figure how to arrange the sitemaps.
I can think of two options, but I'm not sure what the best one is. Maybe there's a third option that I don't even know about.
<sitemap> <loc>http://www.example.com</loc> <lastmod>2006-10-01T18:23:17+00:00</lastmod> <loc>http://www.example.com/about</loc> <lastmod>2006-10-01T18:23:17+00:00</lastmod> <loc>http://blog.example.com</loc> <lastmod>2006-10-01T18:23:17+00:00</lastmod> </sitemap>
In this scenario, I suppose the search engines would crawl to the blog subdomain, but I'm not sure how they'd find the sitemap there. I'd just trust that the search engines find the site map based my uploading them directly via webmaster tools.
The main sitemap could list multiple sitemaps.
<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84"> <sitemap> <loc>http://www.example.com/sitemaps/sitemap.xml</loc> <lastmod>2006-10-01T18:23:17+00:00</lastmod> </sitemap> <sitemap> <loc>http://blog.example.com/sitemap.xml</loc> <lastmod>2006-10-01</lastmod> </sitemap> </sitemapindex>
What's the best practice here?
Neither of your options is allowed.
You need a separate Sitemap file for each host (e.g., subdomain). And you can’t link to these Sitemap files from the same Sitemap index file, i.e., each host also needs its own Sitemap index file (if you want to use one).
About how search engines can find the Sitemaps (index) files, see my answer to the question What should be the name of the sitemap file for Google SEO?
Note that this means that all URLs listed in the Sitemap must use the same protocol (http, in this example) and reside on the same host as the Sitemap. For instance, if the Sitemap is located at
http://www.example.com/sitemap.xml, it can't include URLs from
A Sitemap index file can only specify Sitemaps that are found on the same site as the Sitemap index file. For example,
http://www.yoursite.com/sitemap_index.xmlcan include Sitemaps on
http://www.yoursite.combut not on
- → How do I call the value from another backed page form and use it on a component in OctoberCms
- → Inline JS callback syntax Vs Internal JS callback syntax
- → Prevent form action from being followed by robots
- → How to remove parameters from the root URL if it does I18n
- → SEO Canonical URL in Greek characters
- → Htaccess negation
- → Wrapping anchor elements with text
- → Adding schema.org to site
- → dynamic php title depends on page id and using of "if (isset"
- → Building sitemap for 2 wordpress install under 1 domain
- → Bigcommerce Repeating url
- → 301 Redirection from no-www to www in wordpress
- → Wrapper inside or outside HTML5 semantics main, which is best practice?