blob: 81e3a31a1d5a2433956ed79d928293cea19534dd (
plain)
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
|
package builder
import (
"io"
"website/internal/config"
"github.com/snabb/sitemap"
)
type Sitemap struct {
config *config.Config
Sitemap *sitemap.Sitemap
}
func NewSitemap(cfg config.Config) *Sitemap {
return &Sitemap{
config: &cfg,
Sitemap: sitemap.New(),
}
}
func (s *Sitemap) Add(u *sitemap.URL) {
u.Loc = s.config.BaseURL.JoinPath(u.Loc).String()
s.Sitemap.Add(u)
}
func (s *Sitemap) WriteTo(w io.Writer) (int64, error) {
return s.Sitemap.WriteTo(w)
}
|