forked from andreaskoch/allmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitemap.go
45 lines (36 loc) · 883 Bytes
/
sitemap.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2014 Andreas Koch. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package defaulttheme
import (
"github.com/andreaskoch/allmark/web/view/templates/templatenames"
"fmt"
)
func init() {
templates[templatenames.Sitemap] = sitemapTemplate
templates[templatenames.SitemapEntry] = sitemapContentTemplate
}
const SitemapChildPlaceholder = `@@CHILDS@@`
const sitemapTemplate = `
<header>
<h1 class="title">
{{.Title}}
</h1>
</header>
<section class="description">
{{.Description}}
</section>
<section class="content">
<ul class="tree">
{{ .Tree }}
</ul>
</section>
`
var sitemapContentTemplate = fmt.Sprintf(`<li>
<a href="{{.Path}}" {{ if .Description }}title="{{.Description}}"{{ end }}>{{.Title}}</a>
{{ if .Children }}
<ul>
%s
</ul>
{{ end }}
</li>`, SitemapChildPlaceholder)