65978

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."

wwww.example.com blog.example.com

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.

Option 1

<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.

`

Option 2

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?

Answer1:

Neither of your options is allowed.

You need a separate Sitemap file <strong>for each host</strong> (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?

Source

From the Sitemaps protocol specification about file location:

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 http://subdomain.example.com.

From the Sitemaps protocol specification about index files:

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.xml can include Sitemaps on http://www.yoursite.com but not on http://www.example.com or http://yourhost.yoursite.com.

Recommend

  • Not sure why my XML file is coming up as invalid/no grammar found and why my schema is not validatin
  • PhantomJS crashes when I open too many pages and ignores the last URL
  • Remove index.php from url Laravel 5
  • Why does the order of SOAP parameters matter in PHP SOAP, and how to fix it?
  • Modifying complex csv files in java
  • Multiple plots on one page using ggplot
  • Global PHP class in functions?
  • Compare Pandas dataframes and add column
  • Append dynamic vue component after specific element
  • Display Custom Marker in Google Maps Using Relative File Path [duplicate]
  • C# where to add a method
  • How to remove comma or any characters from Python dataframe column name
  • Iron Router: How do I send data to the layout?
  • Building Qt project for C++11 standard
  • Keep this build forever option - Jenkins
  • How to define custom class, title, and target in Link Browser for content elements and the new rte_c
  • How do I access an unhandled exception in an MVC Error view?
  • Google Custom Search with transparent background
  • Deleting and Updating values from a cusrsor adapter
  • Optimizing database types to compact database (SQLite)
  • Cross-Platform Protobuf Serialization
  • Modifying destination and filename of gulp-svg-sprite
  • vba code to select only visible cells in specific column except heading
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Do I've to free mysql result after storing it?
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Turn off referential integrity in Derby? is it possible?
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • JaxB to read class hierarchy
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • To Get the radio button value in ruby on rails
  • java string with new operator and a literal