summaryrefslogtreecommitdiff
path: root/internal/b2
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2025-10-24 00:28:40 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2025-10-24 00:28:40 +0700
commitadcd8cf82f7ec4027701643c545b1f27a7cfc221 (patch)
treed3a0d95c851108447b6ce55b5326943d3581126c /internal/b2
parentf101d6a555c6d3453def332f2c230b37ae5c81b4 (diff)
downloadweb-adcd8cf82f7ec4027701643c545b1f27a7cfc221.tar.gz
web-adcd8cf82f7ec4027701643c545b1f27a7cfc221.zip
feat: send new blog posts to subscribers
Diffstat (limited to 'internal/b2')
-rw-r--r--internal/b2/client.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/b2/client.go b/internal/b2/client.go
index 7b745a8..d712736 100644
--- a/internal/b2/client.go
+++ b/internal/b2/client.go
@@ -3,6 +3,7 @@ package b2
import (
"context"
"fmt"
+ "slices"
"strings"
"time"
@@ -34,6 +35,7 @@ func NewB2Client(cfg *config.B2Config) (*B2Client, error) {
type BlogPage struct {
Link string
FileName string
+ Lang string
Metadata *frontmatter.Metadata
}
@@ -74,6 +76,9 @@ func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) {
nameParts := strings.Split(linkParts[len(linkParts)-1], ".")
fileName := strings.Join(nameParts[:len(linkParts)-1], ".")
+ tags := strings.Split(attrs.Info["tags"], ",")
+ slices.Sort(tags)
+
filePaths = append(filePaths, &BlogPage{
Link: obj.Name(),
FileName: fileName,
@@ -83,7 +88,7 @@ func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) {
ActionDate: attrs.Info["action-date"],
PublishedTime: publishedTime,
Thumbnail: attrs.Info["thumbnail"],
- Tags: strings.Split(attrs.Info["tags"], ","),
+ Tags: tags,
Geolocation: attrs.Info["geolocation"],
},
})