Skip to content

perf: improve blog and homepage image performance (responsive sizes, lazy-loading, webp) #264

@Shivampal157

Description

@Shivampal157

Summary
The current site (especially the blog and homepage hero/partner logos) serves full‑size images without responsive sizing or lazy‑loading. This can slow down page loads for new visitors and mobile devices.

Motivation

  • Many blog posts use large screenshots or illustrations that are always loaded at full size.
  • The homepage shows several partner logos and hero imagery.
  • Improving image handling will make the site feel faster and more accessible for people on slower connections, which aligns with OSL’s community and education goals.

Proposed improvements

  • Enable lazy‑loading for non‑critical images (e.g. loading="lazy" on blog post images and partner logos).
  • Add responsive image markup for large images (e.g. srcset / sizes or using CSS utility classes) so browsers can pick smaller images on mobile.
  • Add WebP support alongside existing PNG/JPEG assets where it makes sense (keep fallbacks for older browsers).
  • Optionally add a simple image utility partial in the MkDocs/Jinja theme so authors can use a consistent pattern (e.g. a macro to render blog images with lazy‑loading and alt text).

Implementation ideas

  • Update the custom MkDocs theme templates in theme/ (blog post, home, partners) to:

    - Add loading="lazy" to blog content images and partner logos.
    - Use CSS classes or template logic to control image max‑width and responsive behavior.
    
  • For a couple of heavy blog images and the homepage hero:
    - Generate WebP versions and reference them via or srcset while keeping PNG/JPEG as fallback.

  • Document in CONTRIBUTING.md or a short “Authoring images” section how blog authors should add images (alt text, recommended dimensions, etc.).

Acceptance criteria

  • Lighthouse (or similar) shows improved Largest Contentful Paint / Image elements have explicit width and height / Defer offscreen images scores for the homepage and at least one blog post.
  • No visual regressions on desktop and mobile.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions