Middleware that sets a base template name on the context