Open hiqsociety opened 1 year ago
Hello @hiqsociety, you can use layout to solve your problem.
There is a small example:
layout.pug
:go:func(arg) pageTitle string, categories []Category, currentYear int
doctype 5
html(lang="en")
head
meta(charset='UTF-8')
meta(name='viewport' content='width=device-width, initial-scale=1.0')
body
header
block header
block content
footer
block footer
page.pug
extends layout
mixin for(golang)
#cmd Precompile jade templates to #{golang} code.
block header
include header
block footer
//include footer
The Go function generated is Jade_page
(from the file name) with arguments defined in the layout. The output combine layout, page and header.
@UnrealView sorry i just read this.
but can you provide a real life example? all the examples doesnt show how to pass variables to be displayed in header / footer / body.
can you please provide a simple example? it's strange you have .pug when all i see in the example files are .jade
how to pass categories to "include header.jade"? i'm calling Index() once to display all. Any ideas how to pass the categories to the inside of header.jade fille too?
go compile error :
index.jade
header.jade