Add reading progress bar for articles#3014
Open
mortennordbye wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for snazzy-dango-efb2ec ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Adds an optional reading progress bar for articles: a thin, primary-colored bar fixed to the top of the viewport that fills from 0 to 100 percent as the reader scrolls through a page.
Why
Long-form articles have no scroll-position indicator today. This is a common, lightweight blog-theme affordance and there is no equivalent in the theme (the scroll-to-top button only appears past a threshold and shows no progress).
What
article.showReadingProgressparam (defaultfalse), overridable per page via front matter, following the same pattern as the otherarticle.show*flags.layouts/partials/reading-progress.htmlpartial andassets/js/reading-progress.js, mirroring the existing scroll-to-top feature.<script>tag (the same approach used forzen-mode.js) rather than appended to the sharedmain.bundle.js, because that bundle is cached by its target name and the inclusion is page-conditional.z-100so it renders above the fixed header while still being covered by the search overlay (z-500).Verification
hugoproduction build of the exampleSite succeeds with no errors; the script tag and bar element are emitted on article pages and absent on the home and list pages..h-1utility was added to the committed compiled CSS (vianpm run build); no other CSS changed.Issue ticket number and link
N/A
Checklist before requesting a review
Optional reading progress bar for articles, enabled with
article.showReadingProgress.