Fix exception on index generation and add option to strip trailing index.html from generated URLs.

fixes #1