From 1004a391df8f34124bafee337fbbb4d1b13d702e Mon Sep 17 00:00:00 2001 From: kentnek Date: Tue, 23 Jun 2020 23:20:02 +0800 Subject: [PATCH] make dateFormat configurable --- assets/scss/partials/_post-list.scss | 3 +++ exampleSite/config.toml | 2 ++ layouts/_default/list.html | 5 +++-- layouts/_default/single.html | 4 +++- layouts/taxonomy/tag.html | 4 +++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/assets/scss/partials/_post-list.scss b/assets/scss/partials/_post-list.scss index 544bf70..53fc67b 100644 --- a/assets/scss/partials/_post-list.scss +++ b/assets/scss/partials/_post-list.scss @@ -1,3 +1,6 @@ +@import "colors"; +@import "vars"; + .post-list__container { margin: 0 auto; max-width: 1200px; diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 436c7d5..ae89573 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -15,6 +15,8 @@ themesDir = "../../" # Optional params [params] + dateFormat = "Jan 2 2006" + # Links to your social accounts, comment/uncomment as needed. Icons will be displayed for those specified. twitter = "https://twitter.com/" github = "https://github.com/" diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 940338b..d8d52b6 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -3,6 +3,8 @@ {{ end }} {{ define "main" }} + +{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }}
    @@ -10,8 +12,7 @@
  • + >{{ .Date.Format $dateFormat }}

    {{ .Title }}

    diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 5e5a15f..f150a6a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -3,11 +3,13 @@ {{ end }} {{ define "main" }} +{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }} +

    {{.Title}}

    {{ .Date.Format $dateFormat }}
    diff --git a/layouts/taxonomy/tag.html b/layouts/taxonomy/tag.html index 3b66bbc..68aca13 100644 --- a/layouts/taxonomy/tag.html +++ b/layouts/taxonomy/tag.html @@ -3,6 +3,8 @@ {{ end }} {{ define "main" }} + {{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }} +
    All posts/ @@ -12,7 +14,7 @@ {{ range .Data.Pages }}
  • - +

    {{ .Title }}