-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update Headroom implementation to support recent Hugo versions #2950
Conversation
✅ Deploy Preview for academic-demo canceled.
|
✅ Deploy Preview for markdown-slides canceled.
|
✅ Deploy Preview for hugo-portfolio-theme canceled.
|
This PR is stale because it has not had any recent activity. The resources of the project maintainers are limited, and so we are asking for your help. If you feel that the PR is still relevant in the latest release, consider making the PR easier to review and finding developers to help review the PR. Please be mindful that although we encourage PRs, we cannot expand the scope of the project in every possible direction. There will be requests that don't make the roadmap. This PR will automatically close soon if no further activity occurs. Thank you for your contributions. |
This PR is still relevant, as it’s addressing a bug. |
@Agos95 to merge the PR, please refactor the PR so that it is a fix rather than a feature (renaming and converting the options from string to a boolean 'sticky' option is regarded as a new feature rather than a fix). After we fix this PR, the community can discuss in a separate issue or on Discord if it makes sense to limit Headroom's options to only support a boolean 'sticky' option and no other Headroom features. |
Ok, I refactored the code as requested, keeping the string type for this option, and using the value As description of this PR, I copy the comment I put in the code. Loading the Headroom js set the header to disappear when scrolling the page down.
If the header is set to disappear, the Headroom js is loaded. By default, the header is sticky in the homepage and in the book layout, and it disappears when scrolling in all other pages. |
Purpose
TLDR: Fix #2935
As described in #2935, there is a bug in the syntax to set the header sticky. In particular, this is the buggy code:
https://github.com/wowchemy/wowchemy-hugo-themes/blob/57e374fe08d8bb0eee34b160d479a77dc13b8503/modules/wowchemy/layouts/partials/site_js.html#L131
As for now, to make the header sticky you need to set the parameter
but it should be:
In addition, it actually checks if
sticky.header
is set and equal to "disappear", but I think this should be a boolean value.With this PR the sticky header is set following this logic:params.yaml
to set the options to the whole site:The old "buggy" behaviour is still supported in Page params for backward compatibiloity.See #2950 (comment) for an updated description of the logic of this PR.
Documentation
The logic described above should be added here in the documentation, alongside with the
sticky
parameter underheader
inparams.yaml