Skip to content

Commit

Permalink
added date to blog
Browse files Browse the repository at this point in the history
  • Loading branch information
matryer committed Mar 14, 2021
1 parent cc5b298 commit 6485843
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 20 deletions.
34 changes: 24 additions & 10 deletions tools/bloggen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ func newGenerator() (*generator, error) {

func (g *generator) processMarkdownFile(ctx context.Context, path, dest, src string) error {
fmt.Printf("%s\n", path)

pathSegs := strings.Split(path, string(filepath.Separator))
yearStr := pathSegs[0]
monthStr := pathSegs[1]
log.Println("The year and month: ", yearStr, monthStr)

articleTime, err := time.Parse("01/2006", fmt.Sprintf("%s/%s", monthStr, yearStr))
if err != nil {
return errors.Wrap(err, "parse time from path")
}
articleTimeStr := articleTime.Format("January 2006")

b, err := os.ReadFile(src)
if err != nil {
return err
Expand Down Expand Up @@ -172,21 +184,23 @@ func (g *generator) processMarkdownFile(ctx context.Context, path, dest, src str
CurrentCategoryPath string
Categories map[string]metadata.Category

Path string
Title string
Desc string
ImageURL string
HTML template.HTML
Path string
ArticleTimeStr string
Title string
Desc string
ImageURL string
HTML template.HTML
}{
Version: version,
LastUpdatedFormatted: time.Now().Format(time.RFC822),
Categories: g.categories,

Path: path,
Title: title,
Desc: firstLine,
ImageURL: imagePath,
HTML: template.HTML(html),
Path: path,
ArticleTimeStr: articleTimeStr,
Title: title,
Desc: firstLine,
ImageURL: imagePath,
HTML: template.HTML(html),
}
err = g.template.ExecuteTemplate(f, "_main", pagedata)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ xbar plugins can now define Variables in their metadata. End users will be promp

The [new xbar app](https://github.com/matryer/xbar/releases/latest) renders variables like this:

![](xbar-plugin-with-variables.png)
![](xbar-plugin-with-variables.jpg)

## Defining variables

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading

0 comments on commit 6485843

Please sign in to comment.