问题
I am using blogdown 0.14 with a slightly modified hugo-lithium theme.
It seems that the home page of the blog created has changed.
It used to be a page with the toc of the posts, not it is a page with a link to a page where this toc is displayed.
Is there a way to get back the old behavior?
回答1:
That was mentioned an hour ago on twitter:
See gohugoio/hugoThemes issue 682 and gohugoio/hugoThemes issue 678
As stated in gohugoio/hugo#6153, Hugo 0.57.0 has a breaking change since now:
(Actually, 0.58.0 will have those changes, 0.57.2 has reverted some of those breaking changes)
home.Pageswork like the other sectionsAlso due to gohugoio/hugo#6154 now:
.Pagesinclude the sub sectionsThe above breaking changes were made for developing new features like Cascading Front Matter and will be also needed in the future.
However during local testing with Hugo 0.57.0 I noticed that plenty of theme demos currently on the showcase use .Data.Pages or just .Pages to render lists (particularly on the index page) and as a result the list pages of these themes now look weird.
The author of the lithium theme has been notified.
As Yihui Xie (Software engineer @rstudio) comments, the yihui/hugo-lithium fork already illustrates the kind of patch most themes will have to do.
Commit 6da5ac2:
The layouts/_default/list.html included before:
{{ range (where .Data.Pages "Section" "!=" "").GroupByDate "2006" }}
Now:
{{ $pages := .Pages }}
{{ if .IsHome }}
{{ $pages = .Site.RegularPages }}
{{ end }}
{{ range (where $pages "Section" "!=" "").GroupByDate "2006" }}
As mentioned in "Hugo 0.57.2: A couple of Bug Fixes":
This release reverts the behavior for
.Pageson the home page to how it behaved in 0.56, but adds aWARNINGtelling you what to do to prepare for Hugo 0.58.In short,
.Pagehome will from 0.58 only return its immediate children (sections and regular pages).In this release it returns
.Site.RegularPages.
So to prepare for Hugo 0.58 you can either use.Site.RegularPagesin your home template, or if you have a generallist.htmlor RSS template, you can do something like this:{{- $pctx := . -}} {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} {{- $pages := $pctx.RegularPages -}}
来源:https://stackoverflow.com/questions/57528205/blogdown-home-page-not-showing-toc-of-posts-any-more