Skip to content

Commit

Permalink
feat(layouts): Replace .Pages or .Data.Pages with `.Site.RegularP…
Browse files Browse the repository at this point in the history
…ages`

Replace `.Pages` or `.Data.Pages` with `.Site.RegularPages`. And add
`mainSections` variable to config file to prepare for Hugo v.0.58.0.

See also:

* gohugoio/hugoThemes#682
* https://gohugo.io/functions/where/#mainsections
  • Loading branch information
gundamew committed Aug 19, 2019
1 parent 8781ae8 commit ea9283f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions exampleSite/config.toml
Expand Up @@ -31,6 +31,7 @@ disableKinds = ["taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT"]

[params]
dateFormat = "2006-01-02"
mainSections = ["post"]

[params.gravatar]
email = "hugo@example.com"
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/list.html
Expand Up @@ -2,7 +2,7 @@
<main id="list">
<h1>{{ .Title }}</h1>
<ul>
{{ range .Pages }}
{{ range .Site.RegularPages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
<p>{{- partial "date.html" . -}}</p>
Expand Down
2 changes: 1 addition & 1 deletion layouts/home.html
Expand Up @@ -20,7 +20,7 @@
<div id="recent-posts">
<h2>{{ i18n "recent_posts" }}</h2>
<ul>
{{ range first 5 .Pages.ByPublishDate.Reverse }}
{{ range first 5 (where .Site.RegularPages "Type" "in" .Site.Params.mainSections).ByPublishDate.Reverse }}
<li>
<span>{{- partial "date.html" . -}}</span>
<a href="{{ .Permalink }}">{{ .Title }}</a>
Expand Down
2 changes: 1 addition & 1 deletion theme.toml
Expand Up @@ -5,7 +5,7 @@ description = "Nothing but texts."
homepage = "https://github.com/gundamew/hugo-bingo"
tags = ["minimalist", "simple", "clean", "blog", "starter", "responsive"]
features = ["blog"]
min_version = "0.42.2"
min_version = "0.57.2"

[author]
name = "Bing-Sheng Chen"
Expand Down

0 comments on commit ea9283f

Please sign in to comment.