hugo-theme-introduction/layouts/partials/blogsection.html
Vicky 27921af8f3 Fix for issue #9
Added section qualifier for Latest Post
2017-06-01 12:39:04 +08:00

33 lines
No EOL
1.1 KiB
HTML

<div class="container"><!-- Begin Blog container -->
{{ if .Site.Params.showlatest }}
<h2 class="title is-2 has-text-centered">Latest Post</h2>
{{ range first 1 (where .Data.Pages.ByPublishDate "Section" "blog") }}
<div class="summary">{{ .Date.Format .Site.Params.dateform }}
<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 .Data.Pages.ByPublishDate }}
{{ if eq .Section "blog" }}
{{ partial "li.html" . }}
{{ end }}
{{ end }}
</ul>
{{ else }}
<div class="container has-text-centered top-pad"><a href="/blog">ALL BLOG POSTS</a></div>
{{ end }}
</div><!-- End Blog container -->
<div class="container has-text-centered top-pad"><a href="#top"><i class="fa fa-arrow-up"></i></a></div>