SB Sommar – Project Documentation

SB Sommar – Requirements: Caching and Performance

Cache strategy: cache headers, content-hash cache-busting for CSS/JS/images, image dimension and filename rules, image lazy-loading.

Part of the requirements index. Section IDs (02-§N.M) are stable and cited from code; they do not encode the file path.


25. Image Loading Performance

The site must use browser-native loading hints to improve perceived performance and reduce layout shift. No new client-side JavaScript is required.

25.1 Lazy loading for below-fold images

25.2 Hero image preload and priority

25.3 Script loading



38. Replace Hand-Rolled Markdown Converter with marked

The build-time markdown converter (convertMarkdown() and inlineHtml() in render-index.js) supports only a limited subset of markdown. Content authors write standard markdown (including tables) that the converter silently mangles. Replace the hand-rolled converter with the marked library.

38.1 Library integration

38.2 Preserved behaviours

38.3 Full markdown support

38.4 Table styling

38.5 Quality



65. Client-Side Date and Regex Robustness

65.1 Locale-independent date formatting

65.2 Countdown injection regex

65.3 Testimonial image regex robustness



66. Image Dimension Attributes

Every <img> element in the rendered HTML must have explicit width and height attributes. This reserves layout space before the image loads, preventing Cumulative Layout Shift (CLS).

66.1 Fixed-size images

Images whose display size is constant (not responsive) must have hardcoded width and height attributes matching their CSS display dimensions:

66.2 Hero image

66.3 Content and facility images

66.4 No CSS changes



67. Static Asset Cache Headers

The site must serve static assets with appropriate Cache-Control headers to reduce repeat-visit load times. Cache rules are delivered via an Apache .htaccess file in the site root.

67.1 Cache rules

67.2 Build integration

67.3 Separation from API



68. Descriptive Image Filenames

All image files in source/content/images/ must have descriptive, human-readable filenames that follow a consistent naming convention. This makes markdown editing easier for non-technical contributors and aligns filenames with their natural alt-text descriptions.

68.1 Naming convention

68.2 Reference consistency

68.3 Constraints



69. CSS Cache-Busting

HTML files are served with Cache-Control: no-cache and always revalidate, but CSS is cached for up to one week (02-§67.2). When a deploy changes CSS selectors or styles, browsers may serve stale CSS against fresh HTML, causing visual regressions. The build must append a content-based hash to the CSS URL so that any CSS change forces a cache miss.

69.1 Build behaviour

69.2 Constraints



77. JavaScript Cache-Busting

HTML files are served with Cache-Control: no-cache and always revalidate, but JS is cached for up to one week (02-§67.2). When a deploy changes client-side JavaScript, browsers may serve stale scripts against fresh HTML, causing broken behaviour. The build must append a content-based hash to JS URLs so that any JS change forces a cache miss while unchanged files continue to be served from cache.

77.1 Build behaviour

The build appends a deterministic 8-character MD5-based content hash to every <script src="…"> reference in public/ HTML so JS URLs become src="<file>.js?v=<hash>", with identical JS content always producing the same hash. See 03-architecture/ci-and-deploy.md §27 "Asset Cache-Busting" for the canonical mechanism (shared with CSS and image cache-busting).

77.2 Constraints



78. Image Cache-Busting

Images are cached for up to one year (02-§67.1). When an image is replaced with new content but the same filename, browsers may serve the old version indefinitely. The build must append a content-based hash to image URLs in HTML so that changed images force a cache miss while unchanged images continue to be served from cache.

78.1 Build behaviour

The build appends a deterministic 8-character MD5-based content hash to every <img src="…"> reference in public/ HTML so image URLs become src="<file>.<ext>?v=<hash>" (where ext is webp, png, jpg, jpeg, or ico), with identical image content always producing the same hash. See 03-architecture/ci-and-deploy.md §27 "Asset Cache-Busting" for the canonical mechanism (shared with CSS and JS cache-busting).

78.2 Constraints



86. Image Cache-Busting for href and Manifest References

Section 78 covers src attributes in <img> tags. Images also appear in href attributes (<link rel="preload">, <link rel="icon">, <link rel="apple-touch-icon">) and in the PWA manifest (app.webmanifest). These references must receive the same content-based hash so that the browser treats them as identical URLs and avoids redundant downloads.

86.1 Build behaviour

86.2 Constraints