4

I have two sites www.example.com and m.example.com. As it is shown, the latter is the mobile version of the first site. Basically each URL in the www.example.com have a counterpart with same URL string with the mobile version, e.g. m.example.com/book/1 is the counterpart of www.example.com/book/1.

The main site already has a sitemap www.example.com/sitemap.xml.

My first question is, do I really need a sitemap for the mobile version and why?

And second, if I do need it, what is the best way to arrange the sitemap for both main site and mobile site version?

Should I put it in the main site's sitemap, e.g.

<!-- in http://www.example.com/sitemap.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0">

    <!-- the URL for the main site -->
    <url>
        <loc>http://www.example.com/book/1</loc>
    </url>

    <!-- the URL for the mobile site -->
    <url>
        <loc>http://m.example.com/book/1</loc>
        <mobile:mobile/>
    </url>
</urlset>

Or should I put it in the separate file, e.g.

<!-- in http://www.example.com/sitemap.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0">
    <!-- the URL for the main site -->
    <url>
        <loc>http://www.example.com/book/1</loc>
    </url>
</urlset>

..

<!-- in http://m.example.com/sitemap.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0">
    <!-- the URL for the mobile site -->
    <url>
        <loc>http://m.example.com/book/1</loc>
        <mobile:mobile/>
    </url>
</urlset>

Third, should (or should not) I use the same image sitemap tag for both main site version and mobile site version of the same URL?

e.g.

    <!-- main site version -->
    <url>
        <loc>http://www.example.com/book/1</loc>
        <image:image>
            <image:loc>http://example.com/image.jpg</image:loc>
        </image:image>
    </url>

    <!-- mobile site version either in same or different file -->
    <url>
        <loc>http://m.example.com/book/1</loc>
        <mobile:mobile/>
        <image:image>
            <image:loc>http://example.com/image.jpg</image:loc>
        </image:image>
    </url>
  • Keep in mind that mobile sitemaps (like you're using here) are meant for featurephone content (WAP, WML, etc), not for smartphone content. The solution for smartphone sites is in the answer below. – John Mueller Dec 2 '14 at 20:16
3

Not sure if you saw this. Here is a guide from Google describing tactics for your seperated mobile URL situation: Method for mobile with 2 URL's

Basically you set the desktop site as canonical, and mobile as alternate, then use tags to point bots to either-or mode using a preferred hierarchy.

Do almost the same for sitemap, only you can use rel and optional media queries. The media query defines which "version" of the mobile sitemap link to use. In the case of your image, i would include it in the canonical assets (to make it bubble into mobile too).

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
    <loc>http://www.example.com/page-1/</loc>
    <image:image>
        <image:loc>http://example.com/image.jpg</image:loc>
    </image:image>
    <xhtml:link
        rel="alternate"
        media="only screen and (max-width: 640px)"
        href="http://m.example.com/page-1" />
</url>
</urlset>

The guide to do this can be found by searching for "Google mobile site headers". Here is the original lander tutorial for all 3 styles of mobile.

  • 1
    so does that mean I only have to create one sitemap at http://www.example.com/ ? – Eric Hancock Nov 29 '14 at 16:21
  • 1
    Yessir that is correct. 1 sitemap on main domain and use the rel="alternate" to distinguish mobile link(s). You can use multiple alternates too by setting media="" for example at tablet width then a different for small embedded device. – dhaupin Nov 30 '14 at 18:20
  • @EricHancock You should also think about applying the metas found in the Google link above. It will help distinguish the site versions when crawlers are hitting pages without using sitemap. – dhaupin Nov 30 '14 at 19:43
  • You mean link rel=alternate in the desktop site and link rel=canonical in the mobile site? – Eric Hancock Dec 2 '14 at 6:15
  • @EricHancock correct. If you were on mobile site you would wanna see the canonical link pointing to desktop. If you were on the desktop you would wanna see the alternate link pointing to mobile. – dhaupin Dec 2 '14 at 14:12
1

Reply to question 1:

As the domains are different, in this case, one domain and one subdomain I suppose the sites are different too and therefore you should have one sitemap for your Desktop site and one for the Mobile version of it in the same way that you should add Google Webmaster code and verify both sites independently, thus allowing you to submit both sitemaps.

Question 2: As I said above, I would separate the files and link them as you showed.

Question 3: I think the image is irrelevant, but I would make them different, one for each version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.