Set base tag in template

Closes #467.
Closes #417.

As discussed in #467 this cleans up the usage of `<base>` tag.