Created
January 1, 2013 12:59
-
-
Save moraes/4427246 to your computer and use it in GitHub Desktop.
text/template composition using {{block}} and {{fill}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A base template with the layout skeleton. | |
// {{block}} actions define placeholders. | |
{{define "base"}} | |
<html> | |
<head> | |
<title>{{block "title"}}</title> | |
</head> | |
<body> | |
{{block "content"}} | |
</body> | |
</html> | |
{{end}} | |
// A template that fills the base template ("page1 extends base"). | |
// {{fill}} actions fill the blocks defined in the base template. | |
{{define "page1" "base"}} | |
{{fill "title"}}Page 1{{end}} | |
{{fill "content"}}This is Page 1.{{end}} | |
{{end}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment