summaryrefslogtreecommitdiff
path: root/internal/b2
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'internal/b2')
-rw-r--r--internal/b2/client.go25
1 files changed, 5 insertions, 20 deletions
diff --git a/internal/b2/client.go b/internal/b2/client.go
index fda79e0..1a97e5f 100644
--- a/internal/b2/client.go
+++ b/internal/b2/client.go
@@ -3,7 +3,6 @@ package b2
import (
"context"
"fmt"
- "slices"
"strings"
"time"
@@ -33,11 +32,8 @@ func NewB2Client(cfg *config.B2Config) (*B2Client, error) {
}
type BlogPage struct {
- Link string
- FileName string
- Lang string
- ModifiedTime time.Time
- Metadata *frontmatter.Metadata
+ Link string
+ Metadata *frontmatter.Metadata
}
func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) {
@@ -73,28 +69,17 @@ func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) {
return nil, fmt.Errorf("failed to parse published time metadata field: %w", err)
}
- linkParts := strings.Split(obj.Name(), "/")
- nameParts := strings.Split(linkParts[len(linkParts)-1], ".")
- fileName := strings.Join(nameParts[:len(linkParts)-1], ".")
-
- tags := strings.Split(attrs.Info["tags"], ",")
- slices.Sort(tags)
-
- lang, _ := strings.CutPrefix(linkParts[0], c.prefix)
+ linkParts := strings.Split(obj.Name(), ".")
filePaths = append(filePaths, &BlogPage{
- Link: obj.Name(),
- FileName: fileName,
- Lang: lang,
- ModifiedTime: attrs.LastModified,
+ Link: strings.Join(linkParts[:len(linkParts)-1], "."),
Metadata: &frontmatter.Metadata{
Title: attrs.Info["title"],
ShortDescription: attrs.Info["short-description"],
ActionDate: attrs.Info["action-date"],
PublishedTime: publishedTime,
Thumbnail: attrs.Info["thumbnail"],
- Tags: tags,
- Geolocation: attrs.Info["geolocation"],
+ Tags: strings.Split(attrs.Info["tags"], ","),
},
})
}