Skip to content

Commit

Permalink
date support
Browse files Browse the repository at this point in the history
  • Loading branch information
jackharrhy committed Aug 28, 2023
1 parent fc09e37 commit f66e2ee
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion example-content/Creation of Repo.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
categories = ["Events"]
date = "2023-08-23"
date = 2023-08-23
+++

On August 27th, 2023, the repository was created by [[Riley]].
2 changes: 1 addition & 1 deletion example-content/Opening of Fogo Island Inn.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
categories = ["Events"]
date = "2023-06-25"
date = 2023-06-25
+++

https://fogoislandinn.ca/about-us/
2 changes: 1 addition & 1 deletion example-content/go1.19.0.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
date="2022-08-02"
date = 2022-08-02
+++

https://go.dev/doc/go1.19
2 changes: 1 addition & 1 deletion example-content/go1.20.0.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
date="2023-02-01"
date = 2023-02-01
+++

https://go.dev/doc/go1.20
2 changes: 1 addition & 1 deletion example-content/go1.21.0.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
date="2023-08-08"
date = 2023-08-08
+++

https://go.dev/doc/go1.21
11 changes: 6 additions & 5 deletions pkg/content/parsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"strings"
"time"

"github.com/yuin/goldmark"
"github.com/yuin/goldmark/parser"
Expand All @@ -16,11 +17,11 @@ import (
)

type PageMeta struct {
Categories []string `toml:"categories"`
Date string `toml:"date"`
Redirect string `toml:"redirect"`
Root bool `toml:"root"`
YoutubeId string `toml:"youtube_id"`
Categories []string `toml:"categories"`
Date *time.Time `toml:"date"`
Redirect string `toml:"redirect"`
Root bool `toml:"root"`
YoutubeId string `toml:"youtube_id"`
}

type Page struct {
Expand Down
6 changes: 6 additions & 0 deletions pkg/templates/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ var pageTemplateContent = `<!DOCTYPE html>
<main>
<h1>{{ .Page.Title }}</h1>
{{ if .Page.Meta.Date }}
<section>
<p>{{ .Page.Meta.Date.Format "Aug 2, 2006" }}</p>
</section>
{{ end }}
{{ if .Page.Meta.YoutubeId }}
<iframe
width="100%"
Expand Down

0 comments on commit f66e2ee

Please sign in to comment.