🎉Getting Started
Corgi distinguishes between four file types: main files, library files, template files, and included files. While you'll learn about the last three later, let's talk about main files:
The main file is the file that gets compiled to a Go function. Therefore, unlike the other file types, it must define the name and parameters of it's output function. This is done by adding a Go function header without return value to your file:
func MyTemplateFunc(myArg string)
You can also import other packages and use the types, functions, variables, and constants in it in your template.
import
"time"
// import aliases work too!
linkedlist "container/list"
func F(t time.Time, l *linkedlist.List)
After you've written the function header, the content of generated document begins. Everything written there will be used to render the document.
Let's start with something very basic and create a p
element:
func Engage()
doctype html
p Engage!
Last updated
Was this helpful?