Sitemap files

There are two types of sitemap files: An XML version and an HTML version. Each points to all the HTML files on your site, but in slightly different ways. BBEdit used to generate sitemap.html files, but now if you want one you’ll have to generate it yourself. Here’s the code I use, which is the brainchild of Christopher Stone, an active and knowledgeable participant of the BBEdit Talk group on Google Groups.

#!/bin/sh
# generate a TOC of the site files
# thank you, Christopher Stone
cd /Users/greg/Sites/bbedit-guide

grep --include="*.html" -Eir "<title>.+</title>" . \
| sed -E '
      s!^\.!<li><a href="!
      s!:[[:space:]]*<title>[[:space:]]?!">!
      s!</title>!</a></li>!
' \
| bbedit

I recommend that you save this code in the Unix Worksheet for your project. Obviously, each project needs a separate version of this with the correct path to the project files.

If you want a sitemap.xml file, you’ll have to use one of a helper program such as Scrutiny or sitemap_gen.py.