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("02.01.2006")
30 }
31%}
32
33{% code func Ignore[T any](v T, _ error) T {
34 return v
35 }
36%}
37
38Page prints a page implementing Page interface.
39{% func PageTemplate(p Page) %}
40<!DOCTYPE html>
41<html lang="en">
42 <head>
43 <meta charset="utf-8">
44 <link rel="icon" href="data:,">
45 <title>{%= p.Title() %}</title>
46 <link rel="stylesheet" href="/static/main{%s Slug%}.css">
47 <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
48 <meta name="viewport" content="width=device-width, initial-scale=1" />
49 </head>
50 <body>
51 {%= p.Navbar() %}
52 <div class="container">
53 {%= p.Content() %}
54 </div>
55 </body>
56 {%= p.Script() %}
57</html>
58{% endfunc %}