formatted date

This commit is contained in:
Niko Abeler 2022-09-11 17:34:50 +02:00
parent 9ca50eafff
commit 968fb30f53
2 changed files with 5 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<small> <small>
Published: Published:
<time class="dt-published" datetime="{{.Post.Meta.Date}}"> <time class="dt-published" datetime="{{.Post.Meta.Date}}">
{{.Post.Meta.Date}} {{.Post.Meta.FormattedDate}}
</time> </time>
<a class="u-url" href="{{.Post.FullUrl}}">#</a> <a class="u-url" href="{{.Post.FullUrl}}">#</a>
</small> </small>

View File

@ -34,6 +34,10 @@ type PostMeta struct {
Draft bool `yaml:"draft"` Draft bool `yaml:"draft"`
} }
func (pm PostMeta) FormattedDate() string {
return pm.Date.Format("02-01-2006 15:04:05")
}
func (pm *PostMeta) UnmarshalYAML(unmarshal func(interface{}) error) error { func (pm *PostMeta) UnmarshalYAML(unmarshal func(interface{}) error) error {
type T struct { type T struct {
Title string `yaml:"title"` Title string `yaml:"title"`