diff options
author | Mike Crute <mike@crute.us> | 2022-11-30 18:29:05 -0800 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2022-11-30 18:29:05 -0800 |
commit | d88b2d2afb0f8ba47938a2f4269c7bb94d15c45a (patch) | |
tree | 50ca618dbe37c1a7786d7eb199afab7a86e7fa91 /web | |
parent | 640fa503c772a2412f3031ad8899eef6133344f0 (diff) | |
download | golib-d88b2d2afb0f8ba47938a2f4269c7bb94d15c45a.tar.bz2 golib-d88b2d2afb0f8ba47938a2f4269c7bb94d15c45a.tar.xz golib-d88b2d2afb0f8ba47938a2f4269c7bb94d15c45a.zip |
web/sitemaps: add index supportv0.5.1
Diffstat (limited to 'web')
-rw-r--r-- | web/sitemaps/index.go | 22 | ||||
-rw-r--r-- | web/sitemaps/sitemaps.go | 1 |
2 files changed, 22 insertions, 1 deletions
diff --git a/web/sitemaps/index.go b/web/sitemaps/index.go new file mode 100644 index 0000000..b553bc0 --- /dev/null +++ b/web/sitemaps/index.go | |||
@@ -0,0 +1,22 @@ | |||
1 | package sitemaps | ||
2 | |||
3 | import ( | ||
4 | "encoding/xml" | ||
5 | "time" | ||
6 | ) | ||
7 | |||
8 | type SitemapIndex struct { | ||
9 | XMLName xml.Name | ||
10 | Sitemaps []*SitemapRef `xml:"sitemap"` | ||
11 | } | ||
12 | |||
13 | type SitemapRef struct { | ||
14 | Url string `xml:"loc"` | ||
15 | LastModified *time.Time `xml:"lastmod,omitempty"` | ||
16 | } | ||
17 | |||
18 | func NewSitemapIndex() *SitemapIndex { | ||
19 | return &SitemapIndex{ | ||
20 | XMLName: xml.Name{Local: "sitemapindex", Space: xmlns}, | ||
21 | } | ||
22 | } | ||
diff --git a/web/sitemaps/sitemaps.go b/web/sitemaps/sitemaps.go index bf2bb44..9d2f739 100644 --- a/web/sitemaps/sitemaps.go +++ b/web/sitemaps/sitemaps.go | |||
@@ -77,6 +77,5 @@ type SiteUrl struct { | |||
77 | func NewSitemap() *Sitemap { | 77 | func NewSitemap() *Sitemap { |
78 | return &Sitemap{ | 78 | return &Sitemap{ |
79 | XMLName: xml.Name{Local: "urlset", Space: xmlns}, | 79 | XMLName: xml.Name{Local: "urlset", Space: xmlns}, |
80 | Urls: []*SiteUrl{}, | ||
81 | } | 80 | } |
82 | } | 81 | } |