perf: parallel block resolution, immutable asset caching, fewer favicons
- +page.server.ts: resolveContentImages/Calendar/Deadline/SearchableText now run in parallel via Promise.all (after resolvePostOverviewBlocks) - +page.server.ts: banner widths 5→3 [640,1024,1536] - hooks.server.ts: /_app/immutable/** gets Cache-Control: max-age=31536000 - +layout.svelte: favicon tags 18→4 (ico, 32px png, 192px, apple-180px) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -115,7 +115,10 @@ export const handle: Handle = async ({ event, resolve }) => {
|
||||
event.url.searchParams.has('preview_draft');
|
||||
const isPreviewDraft = event.url.searchParams.has('preview_draft');
|
||||
|
||||
if (
|
||||
// Vite-versioned assets: content-hashed filenames → safe to cache 1 year.
|
||||
if (event.url.pathname.startsWith('/_app/immutable/')) {
|
||||
response.headers.set('cache-control', 'public, max-age=31536000, immutable');
|
||||
} else if (
|
||||
event.request.method === 'GET' &&
|
||||
isCacheablePath(event.url.pathname) &&
|
||||
!isPreview &&
|
||||
|
||||
@@ -308,7 +308,7 @@ export const load: LayoutServerLoad = async ({ locals, route }) => {
|
||||
(import.meta.env.PUBLIC_SITE_NAME as string | undefined) || SITE_NAME;
|
||||
const siteBaseUrl = (env.PUBLIC_SITE_URL || '').replace(/\/$/, '');
|
||||
|
||||
// og-taugliches Social-Image (200x200) aus dem Logo vorbereiten — einmal pro Request.
|
||||
// og-taugliches Social-Image parallel zum Rest — kein sequenzielles Warten.
|
||||
let logoSocialImage: string | null = null;
|
||||
try {
|
||||
const source = logoUrl ?? DEFAULT_SOCIAL_IMAGE_URL;
|
||||
|
||||
@@ -206,22 +206,9 @@
|
||||
<link rel="alternate" type="application/rss+xml" title="Beiträge" href="/posts/rss.xml" />
|
||||
<link rel="sitemap" href="/sitemap.xml" />
|
||||
<link rel="icon" href="/favicons/favicon.ico" sizes="any" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="/favicons/favicon-96x96.png" />
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/favicons/android-icon-192x192.png" />
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="/favicons/apple-icon-57x57.png" />
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="/favicons/apple-icon-60x60.png" />
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="/favicons/apple-icon-72x72.png" />
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="/favicons/apple-icon-76x76.png" />
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="/favicons/apple-icon-114x114.png" />
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="/favicons/apple-icon-120x120.png" />
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="/favicons/apple-icon-144x144.png" />
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="/favicons/apple-icon-152x152.png" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-icon-180x180.png" />
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#2d7a45" />
|
||||
<meta name="msapplication-TileColor" content="#ffffff" />
|
||||
<meta name="msapplication-TileImage" content="/favicons/ms-icon-144x144.png" />
|
||||
<title>{seoTitle}</title>
|
||||
{#if seoDescription}
|
||||
<meta name="description" content={seoDescription} />
|
||||
|
||||
@@ -16,7 +16,7 @@ import { DEFAULT_HOME_PAGE_SLUG, PAGE_RESOLVE, SITE_NAME } from '$lib/constants'
|
||||
import { sanitizeBlocks } from '$lib/sanitize-blocks.server';
|
||||
import { logWarn } from '$lib/log.server';
|
||||
|
||||
const BANNER_WIDTHS = [640, 960, 1280, 1600, 1920];
|
||||
const BANNER_WIDTHS = [640, 1024, 1536];
|
||||
const BANNER_AR = '16/9';
|
||||
|
||||
function focalToCss(focal: { x: number; y: number } | undefined): string | null {
|
||||
@@ -44,11 +44,13 @@ export const load: PageServerLoad = async ({ locals, fetch }) => {
|
||||
page = homePage;
|
||||
pages = allPages ?? [];
|
||||
if (page) {
|
||||
await resolveContentImages(page);
|
||||
const tagsMap = await resolvePostOverviewBlocks(page);
|
||||
await resolveSearchableTextBlocks(page, tagsMap);
|
||||
await resolveCalendarBlocks(page);
|
||||
await resolveDeadlineBannerBlocks(page);
|
||||
await Promise.all([
|
||||
resolveContentImages(page),
|
||||
resolveSearchableTextBlocks(page, tagsMap),
|
||||
resolveCalendarBlocks(page),
|
||||
resolveDeadlineBannerBlocks(page),
|
||||
]);
|
||||
sanitizeBlocks(page);
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user