hugo-PaperMod
hugo-PaperMod copied to clipboard
feat(layouts): add iconWidth support for icon
What does this PR change? What problem does it solve?
Adds support for a new field in config's params called iconWidth.
With iconWidth set, Lighthouse will not complain about Cumulative Shift Layouts.
More on topic here.
Was the change discussed in an issue or in the Discussions before? No, it wasn't treated about icons specifically.
PR Checklist
- [ ] This change adds/updates translations and I have used the template present here.
- [ ] I have enabled maintainer edits for this PR.
- [x] I have verified that the code works as described/as intended.
- [ ] This change adds a Social Icon which has a permissive license to use it.
- [x] This change does not include any CDN resources/links.
- [x] This change does not include any unrelated scripts such as bash and python scripts.
- [ ] This change updates the overridden internal templates from HUGO's repository.
@Airscripts Height is enough for resizing the icon keeping the aspect ratio intact. What we can do for cls thing here is print the width of image, which is already available in hugo context. We can add the param for images where the width isn't calculable.
@Airscripts on a side note, if u can, please take a look at #962 for fixing cls as well
@adityatelange I've removed the resize on width and tested it up.
In the meantime I've even cleaned up the code a little bit, just to make it more readable and maintainable.
About the #962 I can look at it for sure.
I'll let you know what it needs to be done in order to work properly and eventually I'll open a dedicated PR.
Thanks!
Kudos, SonarCloud Quality Gate passed! 
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication