Diffstat (limited to 'internal/b2')
| -rw-r--r-- | internal/b2/client.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/b2/client.go b/internal/b2/client.go index 1a97e5f..7b745a8 100644 --- a/internal/b2/client.go +++ b/internal/b2/client.go @@ -33,6 +33,7 @@ func NewB2Client(cfg *config.B2Config) (*B2Client, error) { type BlogPage struct { Link string + FileName string Metadata *frontmatter.Metadata } @@ -69,10 +70,13 @@ 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(), ".") + linkParts := strings.Split(obj.Name(), "/") + nameParts := strings.Split(linkParts[len(linkParts)-1], ".") + fileName := strings.Join(nameParts[:len(linkParts)-1], ".") filePaths = append(filePaths, &BlogPage{ - Link: strings.Join(linkParts[:len(linkParts)-1], "."), + Link: obj.Name(), + FileName: fileName, Metadata: &frontmatter.Metadata{ Title: attrs.Info["title"], ShortDescription: attrs.Info["short-description"], @@ -80,6 +84,7 @@ func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) { PublishedTime: publishedTime, Thumbnail: attrs.Info["thumbnail"], Tags: strings.Split(attrs.Info["tags"], ","), + Geolocation: attrs.Info["geolocation"], }, }) } |