1{% code
2type Selection int
3const (
4 Git Selection = iota
5 List
6 About
7 Config
8)
9%}
10
11{% func insertIfEqual(s, d Selection) %}{% if s == d %} selected{% endif %}{% endfunc %}
12
13
14{% func Navbar (s Selection) %}
15 <nav class="container navbar navbar-expand-sm">
16 <div class="navbar-nav">
17 <a class="nav-link{%= insertIfEqual(s, Git) %}" href="/git">git</a>
18 <a class="nav-link{%= insertIfEqual(s, List) %}" href="/list">list</a>
19 <a class="nav-link{%= insertIfEqual(s, About) %}" href="/about">about</a>
20 <a class="nav-link{%= insertIfEqual(s, Config) %}" href="/config">config</a>
21 </div>
22 </nav>
23{% endfunc %}