Reputation: 3149
I need to render string as html in Revel
. How to do this?
I've tried:
func (c Pages) Show(url string) revel.Result {
bigDig := "<h1>Hello, dig!</h1>"
return c.Render(bigDig)
}
and then in view
:
{{template "header.html" .}}
{{.bigDig}}
{{template "footer.html" .}}
but it doesn't work. How to do this?
Upvotes: 1
Views: 4336
Reputation: 1926
Your var need to be in a template.HTML type.
Read http://golang.org/pkg/html/template/#HTML or https://groups.google.com/forum/#!topic/golang-nuts/8L4eDkr5Q84.
Upvotes: 2