Fix bug where non-html templates were trying to render layout