1This is a base page template. All the other template pages implement this interface.
2
3{% import "strconv" %}
4{% import "time" %}
5
6{% code
7 var Slug = ""
8%}
9
10{% interface
11Page {
12 Title()
13 Content()
14 Script()
15 Navbar()
16}
17%}
18
19
20{% code func FromUInttoString(u *uint) string {
21 if u != nil {
22 return strconv.FormatUint(uint64(*u), 10)
23 }
24 return ""
25 }
26%}
27
28{% code func TimeFormat(t time.Time) string {
29 return t.Format("2006-01-02")
30 }
31%}
32
33Page prints a page implementing Page interface.
34{% func PageTemplate(p Page) %}
35<html lang="en">
36 <head>
37 <meta charset="utf-8">
38 <link rel="icon" href="data:,">
39 <title>cerrado | {%= p.Title() %}</title>
40 <link rel="stylesheet" href="/static/main{%s Slug%}.css">
41 <meta name="viewport" content="width=device-width, initial-scale=1" />
42 </head>
43 <body>
44 {%= p.Navbar() %}
45 <div class="container">
46 {%= p.Content() %}
47 </div>
48 </body>
49 {%= p.Script() %}
50</html>
51{% endfunc %}
52
53{% code type BasePage struct {} %}
54{% func (p *BasePage) Title() %}Empty{% endfunc %}
55{% func (p *BasePage) Body() %}HelloWorld{% endfunc %}
56{% func (p *BasePage) Script() %}{% endfunc %}