diff options
author | Alex Shpak <alex-shpak@users.noreply.github.com> | 2019-03-29 16:59:00 +0100 |
---|---|---|
committer | Alex Shpak <alex-shpak@users.noreply.github.com> | 2019-03-29 16:59:00 +0100 |
commit | 941ca77a327f595e50e0cd22d35e984afb29530d (patch) | |
tree | 94edc9227d22a7ee3dae9eae492b74cf603e4468 /layouts | |
parent | 5b652a1bb136accac19592614bf8b7cdcf18343b (diff) |
Rename DateFormat to BookDateFormat, make format optional
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/docs/git-footer.html | 5 | ||||
-rw-r--r-- | layouts/posts/list.html | 3 | ||||
-rw-r--r-- | layouts/posts/single.html | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/layouts/partials/docs/git-footer.html b/layouts/partials/docs/git-footer.html index a8a126b..4a856d3 100644 --- a/layouts/partials/docs/git-footer.html +++ b/layouts/partials/docs/git-footer.html @@ -2,8 +2,9 @@ <div class="align-center book-git-footer {{ if not .GitInfo }}justify-end{{ else }}justify-between{{ end }}"> {{ with .GitInfo }} <div> - <a href="{{ $.Site.Params.BookRepo }}/commit/{{ .Hash }}" title='Last modified {{ .AuthorDate.Local.Format $.Site.Params.DateFormat }} by {{ .AuthorName }}' target="_blank" rel="noopener"> - <img src="{{ "svg/code-merge.svg" | relURL }}" /> {{ .AuthorDate.Local.Format $.Site.Params.DateFormat }} + {{- $date := .AuthorDate.Local.Format (default "January 2, 2006" $.Site.Params.BookDateFormat) -}} + <a href="{{ $.Site.Params.BookRepo }}/commit/{{ .Hash }}" title='Last modified {{ $date }} by {{ .AuthorName }}' target="_blank" rel="noopener"> + <img src="{{ "svg/code-merge.svg" | relURL }}" /> {{ $date }} </a> </div> {{ end }} diff --git a/layouts/posts/list.html b/layouts/posts/list.html index 9c68a79..18871f2 100644 --- a/layouts/posts/list.html +++ b/layouts/posts/list.html @@ -1,4 +1,5 @@ {{ define "main" }} + {{- $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat -}} {{ $paginator := .Paginate (where .Pages "Params.hidden" "ne" true) }} {{ range sort .Paginator.Pages }} <article> @@ -6,7 +7,7 @@ <a href="{{ .RelPermalink }}">{{ .Title }}</a> </h2> <h5> - <strong>{{ .Date.Format .Site.Params.DateFormat }}</strong> + <strong>{{ .Date.Format $dateFormat }}</strong> </h5> <p class="markdown"> {{- .Summary -}} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 36585e5..a7f94ed 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -1,8 +1,9 @@ {{ define "main" }} +{{- $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat -}} <header> <h1>{{ .Title }}</h1> <h5> - <strong>{{ .Date.Format .Site.Params.DateFormat }}</strong> + <strong>{{ .Date.Format $dateFormat }}</strong> </h5> </header> <article class="markdown"> |