Support template mimetypes

Unless I forgot something the only difference between template versions and normal documents is the mimetype.

Fixes #744.
Fixes #746. (still not sure if this is the best API)
Indeed, was unsure about this methodname. Forgot to add a question about this. Happy to change it to `setIsTemplate` if that works.