Add reading progress bar for articles (#3014)

* Add reading progress bar for articles

* Let page-level showReadingProgress override the site setting

Hugo's default treats false as empty, so a page-level false could not
disable the bar once it was enabled site-wide. Resolve the value by
initialising from the site setting and overriding it only when the
front matter parameter is actually present, and use the same resolved
boolean in single.html and head.html.

* Guard the reading progress handler and mark the listener passive

The script loads in the head without defer, so the scroll listener is
registered before the progress bar element exists. A scroll event fired
during parsing, such as when the browser restores the scroll position on
reload, would throw. Bail out when the element is missing, matching the
guard in background-blur.js, and mark the scroll listener passive as
toc.html already does.
This commit is contained in:
Morten Victor Nordbye authored and GitHub committed 2026-08-16 22:14:45 +01:00
1 parent 74d03343b9
commit 1f82608cd6
9 files changed
+38

No files matched your search

+1
View File
@@ -96,6 +96,7 @@ forgejoDefaultServer = "https://v11.next.forgejo.org"
showPagination = true
invertPagination = false
showReadingTime = true
showReadingProgress = false
showTableOfContents = false
# showRelatedContent = false
# relatedContentLimit = 3