dirindex - simple static HTML index generator
I've been hosting static websites on Amazon's S3 service for a few months now, and generally been very happy with the results. One drawback to this approach at present, though, is that there are no directory listings: the S3 web server will either serve up an existing file, or an error.
Enter dirindex. This little Ruby script generates an HTML directory listing, much like those from Apache or other 'traditional' webservers for a specific directory.
In my case, this site is generated offline using Jekyll, then uploaded to S3 as needed. A few lines of shell script invoke dirindex on each directory which lacks an index:
The idea here is that line 5 iterates through all directories within the site (stripping the leading './' find prepends), line 7 checks if an index.html file already exists there, and if not line 9 creates one in a temporary file then moves it into place. (Since dirindex skips all filenames starting '.', this prevents index files listing themselves.)
Line 12 generates the sitemap XML file using a similar utility which I intend to release here soon.