Support custom templates.

Added the template_dir directive to enable custom page templates. This manually merges #61.