Skip to content

Templates are rendered as plain text, not HTML #2238

Discussion options

You must be logged in to vote

Templates don't need to be HTML, so there's no way for Rocket to know what kind of content they contain unless you specify it via a file extension. That is, naming your template something like index.html.hbs instead of just index.hbs. This is specified in the docs:

The Content-Type of the response is automatically determined by the non-engine extension of the template name or text/plain if there is no extension or the extension is unknown. For example, for a discovered template with file name foo.html.hbs or a manually registered template with name ending in foo.html, the Content-Type is automatically set to ContentType::HTML.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@s0lst1ce
Comment options

Answer selected by s0lst1ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants