32 lines
1.3 KiB
HTML
32 lines
1.3 KiB
HTML
{{ define "main" }}
|
|
<div class="container">
|
|
<main class="post-index">
|
|
<h3 class="posts-item-note">{{ T "home.recent_posts" }}</h3>
|
|
{{/* Show last 5 posts in reverse date order */}}
|
|
{{ $pagesToShow := .Site.RegularPages }}
|
|
{{ $posts := $pagesToShow.ByDate.Reverse }}
|
|
{{ range $posts }}
|
|
<article class="post-item">
|
|
<h4 class="post-item-title">
|
|
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
|
</h4>
|
|
{{/* format date string to create an ISO 8601 string */}}
|
|
{{ $ISO_date := "2006-01-02T15:04:05Z0700" }}
|
|
{{ $configDateFormat := .Site.Params.dateFormat | default "2 Jan 2006" }}
|
|
<time class="post-item-meta" datetime="{{ dateFormat $ISO_date .Date }}">
|
|
{{ time.Format $configDateFormat .Date }}
|
|
{{/* OLD FORMAT: .Date.Format $configDateFormat */}}
|
|
</time>
|
|
</article>
|
|
{{ end }}
|
|
{{ if gt (len $posts) 5 }}
|
|
<p>
|
|
{{ range $firstSection := (where .Site.Sections "Section" "in" (first 1 (.Site.Params.mainSections))) }}
|
|
<a href="{{ $firstSection.Permalink }}">{{ T "home.see_all_posts" }}</a>
|
|
{{ end }}
|
|
</p>
|
|
{{ end }}
|
|
</main>
|
|
</div>
|
|
{{ end }}
|