What happened?
What happened?
Summary
In Stack v4 beta, enabling reading time globally (e.g. params.article.readingTime = true) does not show the “X min read” metadata on single page views (leaf bundle index.md pages).
Workaround: setting readingTime: true in the page front matter makes it appear, which suggests the site-level default is not being read.
Expected behavior
When params.article.readingTime is true, the article header should display the reading time next to the date (clock icon + localized “X min read”).
Actual behavior
Reading time does not appear on the single page view unless readingTime: true is set in that page’s front matter.
Steps to reproduce
Use Stack v4 beta (see Theme version field below).
In site config, enable reading time globally:
If using hugo.toml:
[params.article]
readingTime = true
If using config/_default/params.toml:
[article]
readingTime = true
Create a normal content page with lots of text, e.g. leaf bundle:
content/post/test/index.md (hundreds of words)
Run hugo server and open the single content page.
Observe: no reading time in the article header.
Add readingTime: true in the page front matter → reading time appears.
Suspected cause (code issue)
In v4, article/components/header.html calls the details partial with a dict context:
{{ partial "article/components/details" (dict "Page" $Page "IsList" $IsList) }}
But article/components/details.html computes reading time visibility using .Site:
{{ $showReadingTime := $Page.Params.readingTime | default (.Site.Params.article.readingTime) }}
Because the details partial’s dot (.) is a dict, .Site is not defined (unless passed in), so the default site param is never read. This makes $showReadingTime effectively depend only on $Page.Params.readingTime.
Proposed fix
Change .Site to use the page’s site object (or the global site):
- {{ $showReadingTime := $Page.Params.readingTime | default (.Site.Params.article.readingTime) }}
- {{ $showReadingTime := $Page.Params.readingTime | default ($Page.Site.Params.article.readingTime) }}
(Optionally: use site.Params.article.readingTime instead.)
Additional notes
This appears to be a regression introduced by the v4 refactor to pass dicts into partials.
Other parts of the same partial already use $Page.Site..., so this change is consistent with existing style.
Hugo version
0.155.3
Theme version
v4 beta 7
What browsers are you seeing the problem on?
Chrome
More information about the browser
No response
Relevant log output
Link to Minimal Reproducible Example
https://github.com/CaiJimmy/hugo-theme-stack-starter
What happened?
What happened?
Summary
In Stack v4 beta, enabling reading time globally (e.g. params.article.readingTime = true) does not show the “X min read” metadata on single page views (leaf bundle index.md pages).
Workaround: setting readingTime: true in the page front matter makes it appear, which suggests the site-level default is not being read.
Expected behavior
When params.article.readingTime is true, the article header should display the reading time next to the date (clock icon + localized “X min read”).
Actual behavior
Reading time does not appear on the single page view unless readingTime: true is set in that page’s front matter.
Steps to reproduce
Use Stack v4 beta (see Theme version field below).
In site config, enable reading time globally:
If using hugo.toml:
[params.article]
readingTime = true
If using config/_default/params.toml:
[article]
readingTime = true
Create a normal content page with lots of text, e.g. leaf bundle:
content/post/test/index.md (hundreds of words)
Run hugo server and open the single content page.
Observe: no reading time in the article header.
Add readingTime: true in the page front matter → reading time appears.
Suspected cause (code issue)
In v4, article/components/header.html calls the details partial with a dict context:
{{ partial "article/components/details" (dict "Page" $Page "IsList" $IsList) }}
But article/components/details.html computes reading time visibility using .Site:
{{ $showReadingTime := $Page.Params.readingTime | default (.Site.Params.article.readingTime) }}
Because the details partial’s dot (.) is a dict, .Site is not defined (unless passed in), so the default site param is never read. This makes $showReadingTime effectively depend only on $Page.Params.readingTime.
Proposed fix
Change .Site to use the page’s site object (or the global site):
(Optionally: use site.Params.article.readingTime instead.)
Additional notes
This appears to be a regression introduced by the v4 refactor to pass dicts into partials.
Other parts of the same partial already use $Page.Site..., so this change is consistent with existing style.
Hugo version
0.155.3
Theme version
v4 beta 7
What browsers are you seeing the problem on?
Chrome
More information about the browser
No response
Relevant log output
Link to Minimal Reproducible Example
https://github.com/CaiJimmy/hugo-theme-stack-starter