From 7a40c01dd14f04787f5052d0c89e0d6fb9ce597f Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Mon, 30 Mar 2026 23:25:59 +0700 Subject: feat: build sitemap.xml --- internal/b2/client.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'internal/b2') diff --git a/internal/b2/client.go b/internal/b2/client.go index d712736..fda79e0 100644 --- a/internal/b2/client.go +++ b/internal/b2/client.go @@ -33,10 +33,11 @@ func NewB2Client(cfg *config.B2Config) (*B2Client, error) { } type BlogPage struct { - Link string - FileName string - Lang string - Metadata *frontmatter.Metadata + Link string + FileName string + Lang string + ModifiedTime time.Time + Metadata *frontmatter.Metadata } func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) { @@ -79,9 +80,13 @@ func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) { tags := strings.Split(attrs.Info["tags"], ",") slices.Sort(tags) + lang, _ := strings.CutPrefix(linkParts[0], c.prefix) + filePaths = append(filePaths, &BlogPage{ - Link: obj.Name(), - FileName: fileName, + Link: obj.Name(), + FileName: fileName, + Lang: lang, + ModifiedTime: attrs.LastModified, Metadata: &frontmatter.Metadata{ Title: attrs.Info["title"], ShortDescription: attrs.Info["short-description"], -- cgit v1.3.1+13