OdeToCode IC Logo

SiteMap Macro v2.0

Tuesday, October 17, 2006

Last year I wrote a little macro to generate a web.sitemap file for ASP.NET 2.0. A few people have been asking about support for Web Application Projects, so I've updated the macro.

Download.

This macro walks through the directories of a web project and adds all the content pages to a ASP.NET 2.0 site map file. If you use URL re-writing or virtual path providers, it won't be able to see those URLs. Chances are you'll need to hand tweak the file afterwards as the macro isn't intelligent enough to devise a good title for each page, but it can save a lot of typing to get started.

To install:

  1. Open the macro explorer (Alt+F8).
  2. Right click a macro project and select "New Moduleā€¦"
  3. Name the new module SiteMapMacro
  4. Right click the new module and select "Edit". Clear existing code.
  5. Paste the code from the download into the new file.
  6. In the Project Explorer, right click References and add a reference to System.Xml.dll. Close the editor.

Back in the macro explorer, you should be able to right-click the macro to execute it.