feat: update site URLs and enhance image handling
- Changed site URLs in docker-compose and deployment configurations to remove "www" prefix for consistency. - Improved image handling by introducing warmPostCardImages function for pre-fetching images in posts and tags. - Enhanced PostCard component with responsive image sizes for better performance. - Updated layout to include robots meta tag and JSON-LD structured data for improved SEO. - Added loading state for images in TopBanner component to enhance user experience.
This commit is contained in:
@@ -255,3 +255,35 @@ export function warmResponsiveImage(
|
||||
void fetchFn(u).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire-and-forget Warmup für PostCard-Bilder (Grid: 400px base, 2x density, webp+jpeg).
|
||||
* Spiegelt die URLs, die <RustyImage width={400} aspect="3/2"/> zur Laufzeit anfragt.
|
||||
*/
|
||||
export function warmPostCardImages(
|
||||
posts: Array<{ _rawImageUrl?: string; _imageFocal?: { x: number; y: number } | null }>,
|
||||
fetchFn: typeof fetch,
|
||||
limit = 6,
|
||||
): void {
|
||||
const widths = [400, 800];
|
||||
const formats: Array<'webp' | 'jpeg'> = ['webp', 'jpeg'];
|
||||
for (const post of posts.slice(0, limit)) {
|
||||
const raw = post._rawImageUrl;
|
||||
if (!raw) continue;
|
||||
const focal = post._imageFocal ?? undefined;
|
||||
for (const w of widths) {
|
||||
for (const format of formats) {
|
||||
const url = getCmsImageUrl(raw, {
|
||||
width: w,
|
||||
height: Math.round((w / 3) * 2),
|
||||
fit: 'cover',
|
||||
format,
|
||||
quality: 75,
|
||||
ar: '3/2',
|
||||
...(focal ? { focalX: focal.x, focalY: focal.y } : {}),
|
||||
});
|
||||
void fetchFn(url).catch(() => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user