Templates: Improve template file management

- Template files can be 'optional' and 'hidden'.
- Bugfixes.
- Documentation.