Browse Source

fix list to include images; introduce hideDate parameter

Alexander Avery 3 weeks ago
parent
commit
27dc432d65
  1. 31
      layouts/_default/list.html
  2. 13
      layouts/_default/single.html

31
layouts/_default/list.html

@ -1,10 +1,31 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{- with .Params.authors }}
{{- $author := (index . 0) }}
<h4>Author: <a href={{ printf "/%s/%s" "authors" (urlize $author) }}>{{ $author }}</a></h4>
{{- end }}
{{- if (not .Params.hideDate) }}
{{- $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{- $dateHuman := .Date | time.Format "Mon | Jan 2, 2006" }}
<h4>Posted: <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time></h4>
{{- end }}
{{- range (.GetTerms "tags") }}
<span><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></span>
{{- end }}
{{- partial "image.html"
(dict
"image" (.Resources.GetMatch "featured")
"alt" .Params.featured.alt
"sizes" (slice 320 480 600 800)
"classes" (slice "shadow" "featured")) }}
{{ .Content }}
<section>
{{ range .Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ .Summary }}
{{ end }}
<section class="article-group author-articles">
{{- range .Data.Pages }}
{{ partial "article.html" . }}
{{- end }}
</section>
{{ end }}

13
layouts/_default/single.html

@ -1,17 +1,22 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{ $dateHuman := .Date | time.Format "Mon | Jan 2, 2006" }}
{{ with .Params.authors }}
{{ $author := (index . 0) }}
<h4>Author: <a href={{ printf "/%s/%s" "authors" (urlize $author) }}>{{ $author }}</a></h4>
{{ end }}
{{- if (not .Params.hideDate) }}
{{- $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
{{- $dateHuman := .Date | time.Format "Mon | Jan 2, 2006" }}
<h4>Posted: <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time></h4>
{{- end }}
{{- range (.GetTerms "tags") }}
<span><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></span>
{{- end }}
{{ partial "image.html"
{{- partial "image.html"
(dict
"image" (.Resources.GetMatch "featured")
"alt" .Params.featured.alt

Loading…
Cancel
Save