Description
If i need to define the view file i'll write {{ define "web/articles/show" }}
then extend from the base template and define content inside it like this
{{ define "web/articles/show" }}
{{ template "web/layouts/base" .}}
{{ define "content" }} show {{ end }}
{{ end }}
It return an error ##unexpected
So how to define a template that extend from another template
Environment
- go version: 1.17
- gin version (or commit ref): v1.7.7
- operating system: ubuntu
Comment From: Ianmuhia
would be great if you can provide more info like a stacktrace or smthn. In the meantime you can check on https://github.com/gin-contrib/multitemplate
. This is a custom HTML render to support multi templates, ie. more than one *template.Template. Gin allow by default use only one html.Template. Check a multitemplate render for using features like go 1.6 block template