1This is a base page template. All the other template pages implement this interface.
2
3{% interface
4Page {
5 Title()
6 Content()
7 Script()
8}
9%}
10
11
12Page prints a page implementing Page interface.
13{% func PageTemplate(p Page) %}
14<html lang="en">
15 <head>
16 <meta charset="utf-8">
17 <title>img | {%= p.Title() %}</title>
18 <link rel="stylesheet" href="/static/main.css">
19 <link rel="icon" href="/static/square.svg" sizes="any" type="image/svg+xml">
20 <meta name="viewport" content="width=device-width, initial-scale=1" />
21 </head>
22 <body>
23 <nav class="navbar">
24 <div class="navbar-start">
25 <a href="/fs" class="navbar-item">
26 files
27 </a>
28 <a href="/media" class="navbar-item">
29 media
30 </a>
31 <a href="/settings" class="navbar-item">
32 settings
33 </a>
34 </div>
35 </nav>
36 <div class="container">
37 {%= p.Content() %}
38 </div>
39 </body>
40 {%= p.Script() %}
41</html>
42{% endfunc %}
43
44{% code type BasePage struct {} %}
45{% func (p *BasePage) Title() %}Empty{% endfunc %}
46{% func (p *BasePage) Body() %}HelloWorld{% endfunc %}
47{% func (p *BasePage) Script() %}{% endfunc %}