Skip to content

Commit

Permalink
Fix for home.Pages behaviour change in Hugo in version 0.58.0 and later
Browse files Browse the repository at this point in the history
There was a change in Hugo in version 0.58.0 and later changing the behaviour of home.Pages value. This pull request fixes the AllinOne theme home page to behave same as prior the 0.58.0 version.
  • Loading branch information
svetlemodry committed Dec 8, 2019
1 parent 600a967 commit 2d5dd34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ <h1 class="display-3">{{ $.Site.Params.welcome_head }}</h1>
<!-- Post list -->
<!-- <div class="pt-5 px-5 mx-5"> -->
<div class="col-md-9 mt-3">
{{ $totalpostscount := len (.Data.Pages) }}
{{ $totalpostscount := len (.Site.RegularPages) }}
{{ $latestpostscount := .Site.Params.latestpostscount | default $totalpostscount }}
{{ if gt $latestpostscount 0 }}
<!-- <div class='post-heading'>
{{ i18n "latestPosts" }}
</div> -->
<div>
{{ range (first $latestpostscount .Data.Pages.ByPublishDate.Reverse ) }}
{{ range (first $latestpostscount .Site.RegularPages.ByPublishDate.Reverse ) }}
{{ partial "post-card.html" . }}
{{ end }}

Expand All @@ -57,4 +57,4 @@ <h1 class="display-3">{{ $.Site.Params.welcome_head }}</h1>
</main>
<!--Main layout-->

{{ end }}
{{ end }}

1 comment on commit 2d5dd34

@svetlemodry
Copy link
Author

@svetlemodry svetlemodry commented on 2d5dd34 Dec 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gohugoio/hugo#6238

Before:
broken

After:
fixed

Please sign in to comment.