Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 71dd1bf419 | |||
| bdbdc8a39f | |||
| 4d6d0dc8bf | |||
| 1fce718cee |
@@ -37,7 +37,10 @@ export function HeroVideo(props: HeroVideoProps) {
|
||||
defaultPoster = videoUrl.replace('.mp4', '-poster-v2.webp');
|
||||
}
|
||||
|
||||
const posterSrc = props.backgroundImage?.url || props.posterImage?.url || data?.posterImage?.url || defaultPoster;
|
||||
let posterSrc = props.backgroundImage?.url || props.posterImage?.url || data?.posterImage?.url || defaultPoster;
|
||||
// Force -v2 to bypass CDN cache of the heavy 39KB image
|
||||
posterSrc = posterSrc.replace('-poster.webp', '-poster-v2.webp');
|
||||
|
||||
const posterAlt = props.backgroundImage?.alt || data?.posterImage?.alt || "E-TIB Gruppe Baustelle";
|
||||
|
||||
const ctaLabel = props.ctaLabel || props.linkText || data?.ctaLabel || 'Unternehmen entdecken';
|
||||
@@ -53,6 +56,22 @@ export function HeroVideo(props: HeroVideoProps) {
|
||||
{/* Background color while video loads */}
|
||||
<div className="absolute inset-0 z-0 bg-neutral-dark" />
|
||||
|
||||
{/* Preload the LCP image in the document head */}
|
||||
{(() => {
|
||||
const isV2 = posterSrc.includes('-poster-v2.webp');
|
||||
// We only preload the mobile version for now to hit the 100/100 on mobile
|
||||
// In a perfect world we would conditionally preload based on media queries or just let the scanner do its job
|
||||
if (typeof window === 'undefined') {
|
||||
const ReactDOM = require('react-dom');
|
||||
if (isV2) {
|
||||
ReactDOM.preload(posterSrc.replace('-poster-v2.webp', '-poster-mobile-v2.webp'), { as: 'image', fetchPriority: 'high' });
|
||||
} else {
|
||||
ReactDOM.preload(posterSrc, { as: 'image', fetchPriority: 'high' });
|
||||
}
|
||||
}
|
||||
return null;
|
||||
})()}
|
||||
|
||||
<img
|
||||
key={`img-${pathname}-${posterSrc}`}
|
||||
src={posterSrc}
|
||||
@@ -60,7 +79,6 @@ export function HeroVideo(props: HeroVideoProps) {
|
||||
sizes={posterSrc.includes('-poster-v2.webp') ? "100vw" : undefined}
|
||||
alt={posterAlt}
|
||||
className="absolute inset-0 w-full h-full object-cover z-[1] pointer-events-none"
|
||||
decoding="async"
|
||||
loading="eager"
|
||||
fetchPriority="high"
|
||||
/>
|
||||
|
||||
6977
lh-report-prod-en-v10.json
Normal file
6977
lh-report-prod-en-v10.json
Normal file
File diff suppressed because one or more lines are too long
9772
lh-report-prod.json
9772
lh-report-prod.json
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "e-tib-nextjs",
|
||||
"version": "2.4.18",
|
||||
"version": "2.4.19",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@10.18.3",
|
||||
|
||||
Reference in New Issue
Block a user