url
Technical notes on web development, DevOps, and AI integration.
2 articles
- 00:54frontend
24 Pages, Zero Media: Paths Measured from the Wrong Directory
One generator change left 24 documentation pages empty: every media file 404'd because src paths were measured from the repo root, not the page's folder.
TL;DR: A static site generator produced 24 pages where all media 404'd, blamed first on disk-opening but actually caused by src paths written from the repo root instead of each page's folder. Relative URLs resolve against the document's own directory, not the generator's working directory. The fix computes each src via path.relative from pageDir, handling Windows separators.
#html#nodejs#documentation - 00:40frontend
Deep-Link Video in Mega Menu: URL, State, Preload Done Right
Three URL layers for mega menu video deep-links: path for identity, query for panel state, hash for timestamp. Manual sync of video.currentTime to hash. Preload metadata + poster, not auto. Prefetch route on hover, not auto.
TL;DR: Use path segments for video identity, query strings for panel state, and hash fragments for timestamps to create bookmarkable URLs. React Activity preserves component state but not video playback, so manually sync currentTime with the hash on mount and timeupdate. For mega panels, set preload="metadata" with posters and manually prefetch on hover since hidden elements skip automatic prefetching.
#frontend#performance#nextjs