Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

For static websites, I always made a Sitemap.xml file and submitted it to search engines like google, bing etc.

But now, I have made a website in Asp.net MVC which has 3 dynamic pages which yields content for the supplied id. For example there is a Store controller with Section action method that takes an id (like electronics) as parameter and shows the result for it.

Since the website is dynamic in nature, I am not sure whether I should make a sitemap or not. And if I should what should the sitemap have. In essence, How can i submit my site to search engines for indexing?

I tried checking Programmers and SO for sitemap and they don't have any. So does this mean i should leave it entirely on google bots to discover my site and index it. I just need to know the basic steps for a dynamic Asp.net MVC website

share|improve this question

migrated from programmers.stackexchange.com Dec 28 '11 at 17:10

This question came from our site for professional programmers interested in conceptual questions about software development.

    
SO does have a site map see meta.stackexchange.com/questions/33965/… –  Daveo Dec 29 '11 at 0:07

3 Answers 3

up vote 3 down vote accepted

You can always create a dynamic sitemap :)

All you need to do is assemble all the current dynamic elements, and present them in xml format. For example, if you have a simple e-shop with multiple products, your sitemap should look like:

<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>http://www.blahblahblah.com/products/1</loc>
      ...
   </url>
   <url>
      <loc>http://www.blahblahblah.com/products/2</loc>
      ...
   </url>
   <url>
      <loc>http://www.blahblahblah.com/products/3</loc>
      ...
   </url>

   ... 

</urlset> 

You'll need a sitemap controller that queries the database and gets all products, and then displays them in an xml view. I don't know the specifics for ASP.Net MVC, but the guys over at StackOverflow do. The lastmod dates should be the actual timestamps you store in your database. And of course, you can add every possible url for your site in there, regardless if it's static or dynamic content.

It doesn't matter that your sitemap url shows dynamic content and you can even make it look like www.blahblahblah.com/sitemap.xml via routing. You should be aware that there are some limits:

Sitemap files have a limit of 50,000 URLs and 10 megabytes per sitemap. Sitemaps can be compressed using gzip, reducing bandwidth consumption. Multiple sitemap files are supported, with a Sitemap index file serving as an entry point. Sitemap index files may not list more than 50,000 Sitemaps and must be no larger than 10MB (10,485,760 bytes) and can be compressed. You can have more than one Sitemap index file.3

As with all XML files, any data values (including URLs) must use entity escape codes for the characters ampersand (&), single quote ('), double quote ("), less than (<), and greater than (>).

The sitemap index file can also be dynamic. Make sure you cache appropriately, you don't want to do any costly database calls each and every time the bot visits. This might be a little tricky, you'll have to choose the cache interval based on how often you update your dynamic content.

And here's an ASP.Net MVC tutorial that goes into a little bit more detail.

share|improve this answer
    
each step one take towards automation, he needs to take 10 more :P .... For a simple sitemap, I now need to write an action method that returns xml ...LOL....BTW thanks for the info mate, i will get myself running now !! –  Pankaj Upadhyay Dec 28 '11 at 12:35
2  
Well you don't really have to do it. Concentrate on everything else first, leave the SEO stuff for the end. Most bots will crawl your site anyway, and sitemaps don't really add that much, especially for newer sites. –  Yannis Dec 28 '11 at 12:37
    
Instead of a completely dynamic sitemap, I'd suggest using your script to write it out to a static file, then give google that URL. You can then call your script any time to regenerate the XML file. –  DisgruntledGoat Dec 30 '11 at 3:51

Jeff Atwood asked a similar question over on the Pro Webmasters StackExchange.

The Sitemap Paradox

The word from Google:

Granted, for really small, static, easily crawlable sites, using Sitemaps may be unnecessary from Google's point of view once the site has been crawled and indexed. For anything else, I'd really recommend using them.

Worth reading in its entirety.

share|improve this answer
    
+1 for the reference –  rcdmk Jan 7 '12 at 20:05

Most of search engines assumes that you have a robots.txt in your root. And looks for it. In robots.txt you can declare your site map path. In that case, you can write a IHttpHandler to serve your sitemap dynamically within a custom path (e.g. Sitemap.ashx). This method works well for our CMS.

If you also target some ancient search engines which assume you've placed sitemap in your root as sitemap.xml. You need IIS 7 support to extension-less URL rewriting. With that you can rewrite sitemap.xml to sitemap.ashx or something like that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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