1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-06-26 16:13:45 +02:00

layouts/partials/sidebar.html: Use .Site.RegularPages instead of .Site.Pages

As of Hugo 0.18 .Site.Pages now returns all pages, including pages,
home, taxonomies, etc, and you are expected to filter them by their
"kind". There is a new variable .Site.RegularPages which returns a
range of "regular" pages like in pre-0.18 Hugo.

In this instance we are limiting the range to pages with the type
"post", so our current behavior works, but I'd rather be consistent
with other ranges we're using, like on the homepage and taxonomy
list pages.

See: https://github.com/spf13/hugo/releases/tag/v0.18
This commit is contained in:
Alan Orth 2017-01-19 15:08:55 +02:00
parent b1f07d1bbc
commit 4b768d9da4
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -12,7 +12,7 @@
<section class="sidebar-module">
<h4>{{ i18n "recentPosts" }}</h4>
<ol class="list-unstyled">
{{ range first $num_recent_posts (where .Site.Pages "Type" "post") }}
{{ range first $num_recent_posts (where .Site.RegularPages "Type" "post") }}
<li><a href="{{.RelPermalink}}">{{.Title | markdownify }}</a></li>
{{ end }}
</ol>