diff options
author | Bing-Sheng Chen <gundamew@gmail.com> | 2019-08-19 12:29:20 +0300 |
---|---|---|
committer | Bing-Sheng Chen <gundamew@gmail.com> | 2019-08-19 12:47:08 +0300 |
commit | ea9283f49a4d852127d013c9d25b962f7f7f4528 (patch) | |
tree | edc8478ab24a62cd52d2a365c20a9ecb8d174944 | |
parent | 8781ae895fd989e05545ae6f3708724d275bba07 (diff) |
feat(layouts): Replace `.Pages` or `.Data.Pages` with `.Site.RegularPages`v1.7.0
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:
* https://github.com/gohugoio/hugoThemes/issues/682
* https://gohugo.io/functions/where/#mainsections
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/_default/list.html | 2 | ||||
-rw-r--r-- | layouts/home.html | 2 | ||||
-rw-r--r-- | theme.toml | 2 |
4 files changed, 4 insertions, 3 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 260395d..4008004 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -31,6 +31,7 @@ disableKinds = ["taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT"] [params] dateFormat = "2006-01-02" + mainSections = ["post"] [params.gravatar] email = "hugo@example.com" diff --git a/layouts/_default/list.html b/layouts/_default/list.html index ff00fae..0e5fba2 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -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> diff --git a/layouts/home.html b/layouts/home.html index db217fa..aefe241 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -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> @@ -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" |