#162, Add docs/date partial, for date customization
This commit is contained in:
parent
6234f12654
commit
8927a3c672
3 changed files with 9 additions and 4 deletions
6
layouts/partials/docs/date.html
Normal file
6
layouts/partials/docs/date.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
<!--
|
||||
Returns formatted date.
|
||||
Usage: partial "docs/date" (dict "Date" .Date "Format" .Site.Params.BookDateFormat)
|
||||
-->
|
||||
{{- $format := default "January 2, 2006" .Format -}}
|
||||
{{- return (.Date.Format $format) -}}
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
{{ if and .GitInfo .Site.Params.BookRepo }}
|
||||
<div>
|
||||
{{ $date := .GitInfo.AuthorDate.Local.Format (default "January 2, 2006" .Site.Params.BookDateFormat) }}
|
||||
{{- $date := partial "docs/date" (dict "Date" .GitInfo.AuthorDate.Local "Format" .Site.Params.BookDateFormat) -}}
|
||||
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/commit/{{ .GitInfo.Hash }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener">
|
||||
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="Calendar" />
|
||||
<span>{{ $date }}</span>
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
{{ $dateFormat := (default "January 2, 2006" .Site.Params.BookDateFormat) }}
|
||||
{{ with .Date}}
|
||||
<h5>{{ .Format $dateFormat }}</h5>
|
||||
<h5>{{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}</h5>
|
||||
{{ end }}
|
||||
|
||||
{{ range $taxonomy, $_ := .Site.Taxonomies }}
|
||||
{{ with $terms := $.GetTerms $taxonomy }}
|
||||
<div>
|
||||
{{ range $n, $term := $terms }}{{ if $n }}, {{ end }}
|
||||
<a href="{{ $term.RelPermalink }}">{{ $term.Title }}</a>
|
||||
<a href="{{ $term.RelPermalink }}">{{ $term.Title }}</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue