Skip to content

Standardize the sponsor images - #647

Merged
dschrempf merged 4 commits into
hakyllfrom
dom/sponsors
Oct 14, 2026
Merged

dschrempf merged 4 commits into
hakyllfrom
dom/sponsors

Conversation

@dschrempf

Copy link
Copy Markdown
Collaborator

This was annoying me for a long time. When scrolling down to the sponsors, there was a considerable lag. This was because the Standard Chartered logo was huge.

This standardizes the logos, and ensures they stay small (1000px) in CI.


Checklist

The footer, which is on every page, showed a 15950 x 8378 PNG in a 192 px
slot. Browsers decode an image at full size whatever size it is shown at:
about 535 MB of pixels and close to two seconds in Firefox, on every page
load, while Chromium refused to decode it at all. That was the lag before
the sponsor logos appeared.

Replace it with the 200/400/683 px set and srcset the other sponsors use.
They were the only sponsors served as a single file, up to 1262 px wide.
Export the 200/400/683 px set the others have.
Without a sizes attribute a srcset assumes the image spans the whole
viewport, so every logo fetched its 683 px file for a 96 to 192 px slot.
The logo <img> tags carried no dimensions, so the footer reflowed as each
logo arrived. sponsorCtx now gives templates the logo's intrinsic
logoWidth/logoHeight, read with pandoc's imageSize, and the browser
reserves the right box before the file loads.

The same read fails the build when a logo is wider than maxLogoWidth
(1000 px) or not an image, so an export like the 15950 px Standard
Chartered one cannot reach the site again: CI runs `site rebuild`.

The bytes come from a "bytes" version of assets/images/sponsors/**, loaded
rather than read from disk, so pages depend on their logos and `site
watch` rebuilds them when one is replaced. A sponsor's logo must
therefore live under that directory.
@dschrempf
dschrempf marked this pull request as ready for review October 14, 2026 14:16

@LaurentRDC LaurentRDC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@dschrempf
dschrempf merged commit 0a05904 into hakyll Oct 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants