Skip to content

Commit

Permalink
Fix missing content with new Hugo.
Browse files Browse the repository at this point in the history
It seems with newer Hugo the main page needs to use `.Site.Pages`
instead of `.Pages` in order for the page content to show up.

This seems to also pull in the folder as a data item, it's fine for the
products as they have an `onhomepage` filter. For the blog posts I added
in a filter to make sure there was a `processed` tag in order to filter
out the folder.

Issue #2052
  • Loading branch information
dj2 committed May 31, 2021
1 parent 0f1b45b commit eaf2be5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>

<div class='row equal'>
{{ $posts := where .Pages ".Section" "==" "products" }}
{{ $posts := where .Site.Pages ".Section" "==" "products" }}
{{ $homepage := where $posts ".Params.onhomepage" true }}
{{ range $idx, $post := first 4 $homepage }}
{{ if and (ne $idx 0) (eq (mod $idx 2) 0) }}
Expand Down Expand Up @@ -87,7 +87,8 @@ <h2>{{i18n "featured-post" }}</h2>
</div>
</div>
<div class="row blog-posts">
{{ $posts := where .Pages "Section" "blog" }}
{{ $p := where .Site.Pages "Section" "==" "blog" }}
{{ $posts := where $p ".Params.processed" ">" 0 }}
{{ range first 3 $posts }}
<div class="col-xs-12 col-md-4">
<div class='post'>
Expand Down

0 comments on commit eaf2be5

Please sign in to comment.