hugo-theme-introduction/layouts/partials/blogsection.html
2018-06-25 15:03:18 +02:00

37 lines
1.4 KiB
HTML

{{ with .Site.GetPage "section" "blog" }}
<div class="section" id="blog">
<!-- Begin Blog container -->
<div class="container">
{{ if .Site.Params.showLatest }}
<h2 class="title is-2 has-text-centered">Latest Post</h2>
{{ range first 1 (where .Data.Pages.ByPublishDate.Reverse "Section" "blog") }}
<div class="summary">{{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }}
<h3 class="title is-3 latest-post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<div class="markdown">
{{ .Summary }}
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">...Read More</a>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
{{ if .Site.Params.showAllPosts }}
<h2 class="title is-2 has-text-centered top-pad">All Posts</h2>
<ul>
{{ range .Pages }}
{{ partial "li.html" . }}
{{ end }}
</ul>
{{ else }}
<div class="container has-text-centered top-pad"><a href={{ "/blog" | relURL }}>ALL BLOG POSTS</a></div>
{{ end }}
</div>
<!-- End Blog container -->
{{ partial "top-icon.html" . }}
</div>
<!-- End Blog section -->
<div class="container"><hr></div>
{{ end }}