diff --git a/README.md b/README.md index 35fe9df4..c11b56ca 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,8 @@ _⚠️ READ BEFORE PROCEEDING_ Application behavior can be changed by configuring the following environment variables: - `NEXT_PUBLIC_PRO_MODE = 1` enables higher quality image storage (results in increased storage usage) -- `NEXT_PUBLIC_STATICALLY_OPTIMIZE = 1` enables static optimization, i.e., renders pages and images at build time (results in increased project usage)—⚠️ _Experimental_ +- `NEXT_PUBLIC_STATICALLY_OPTIMIZE_PAGES = 1` enables static optimization for pages, i.e., renders pages at build time (results in increased project usage)—⚠️ _Experimental_ +- `NEXT_PUBLIC_STATICALLY_OPTIMIZE_OG_IMAGES = 1` enables static optimization for OG images, i.e., renders images at build time (results in increased project usage)—⚠️ _Experimental_ - `NEXT_PUBLIC_BLUR_DISABLED = 1` prevents image blur data being stored and displayed (potentially useful for limiting Postgres usage) - `NEXT_PUBLIC_GEO_PRIVACY = 1` disables collection/display of location-based data - `NEXT_PUBLIC_IGNORE_PRIORITY_ORDER = 1` prevents `priority_order` field affecting photo order diff --git a/src/app/p/[photoId]/image/route.tsx b/src/app/p/[photoId]/image/route.tsx index ac9a761d..9ff57e29 100644 --- a/src/app/p/[photoId]/image/route.tsx +++ b/src/app/p/[photoId]/image/route.tsx @@ -4,14 +4,14 @@ import PhotoImageResponse from '@/image-response/PhotoImageResponse'; import { getIBMPlexMonoMedium } from '@/site/font'; import { ImageResponse } from 'next/og'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; -import { STATICALLY_OPTIMIZED } from '@/site/config'; +import { STATICALLY_OPTIMIZED_OG_IMAGES } from '@/site/config'; import { GENERATE_STATIC_PARAMS_LIMIT, getPhotoIds } from '@/photo/db'; import { isNextImageReadyBasedOnPhotos } from '@/photo'; export let generateStaticParams: (() => Promise<{ photoId: string }[]>) | undefined = undefined; -if (STATICALLY_OPTIMIZED) { +if (STATICALLY_OPTIMIZED_OG_IMAGES) { generateStaticParams = async () => { const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT }); return photos.map(photoId => ({ photoId })); diff --git a/src/app/p/[photoId]/layout.tsx b/src/app/p/[photoId]/layout.tsx index e4c0c630..20380d6e 100644 --- a/src/app/p/[photoId]/layout.tsx +++ b/src/app/p/[photoId]/layout.tsx @@ -12,13 +12,13 @@ import { } from '@/site/paths'; import PhotoDetailPage from '@/photo/PhotoDetailPage'; import { getPhotosNearIdCachedCached } from '@/photo/cache'; -import { STATICALLY_OPTIMIZED } from '@/site/config'; +import { STATICALLY_OPTIMIZED_PAGES } from '@/site/config'; import { GENERATE_STATIC_PARAMS_LIMIT, getPhotoIds } from '@/photo/db'; export let generateStaticParams: (() => Promise<{ photoId: string }[]>) | undefined = undefined; -if (STATICALLY_OPTIMIZED) { +if (STATICALLY_OPTIMIZED_PAGES) { generateStaticParams = async () => { const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT }); return photos.map(photoId => ({ photoId })); diff --git a/src/components/ExperimentalBadge.tsx b/src/components/ExperimentalBadge.tsx index 0e4b60d9..d3d51a0d 100644 --- a/src/components/ExperimentalBadge.tsx +++ b/src/components/ExperimentalBadge.tsx @@ -12,6 +12,7 @@ export default function ExperimentalBadge({ className={clsx( 'text-pink-500 dark:text-white', 'bg-pink-100 dark:bg-pink-600', + 'pt-0.5', className, )}> Experimental diff --git a/src/site/SiteChecklistClient.tsx b/src/site/SiteChecklistClient.tsx index 5201a3fc..546ce113 100644 --- a/src/site/SiteChecklistClient.tsx +++ b/src/site/SiteChecklistClient.tsx @@ -42,6 +42,8 @@ export default function SiteChecklistClient({ showExifInfo, isProModeEnabled, isStaticallyOptimized, + arePagesStaticallyOptimized, + areOGImagesStaticallyOptimized, isBlurEnabled, isGeoPrivacyEnabled, isPriorityOrderEnabled, @@ -120,7 +122,8 @@ export default function SiteChecklistClient({ > @@ -138,10 +141,13 @@ export default function SiteChecklistClient({ const renderSubStatus = ( type: ComponentProps['type'], label: ReactNode, + iconClassName?: string, ) =>
- - + + + + {label}
; @@ -360,7 +366,16 @@ export default function SiteChecklistClient({ > Set environment variable to {'"1"'} to enable static optimization, i.e., rendering pages and images at build time: - {renderEnvVars(['NEXT_PUBLIC_STATICALLY_OPTIMIZE'])} + {renderSubStatus( + arePagesStaticallyOptimized ? 'checked' : 'optional', + renderEnvVars(['NEXT_PUBLIC_STATICALLY_OPTIMIZE_PAGES']), + 'translate-y-[4.5px]', + )} + {renderSubStatus( + areOGImagesStaticallyOptimized ? 'checked' : 'optional', + renderEnvVars(['NEXT_PUBLIC_STATICALLY_OPTIMIZE_OG_IMAGES']), + 'translate-y-[4.5px]', + )} 0, @@ -162,7 +165,12 @@ export const CONFIG_CHECKLIST_STATUS = { showFilmSimulations: SHOW_FILM_SIMULATIONS, showExifInfo: SHOW_EXIF_DATA, isProModeEnabled: PRO_MODE_ENABLED, - isStaticallyOptimized: STATICALLY_OPTIMIZED, + isStaticallyOptimized: ( + STATICALLY_OPTIMIZED_PAGES || + STATICALLY_OPTIMIZED_OG_IMAGES + ), + arePagesStaticallyOptimized: STATICALLY_OPTIMIZED_PAGES, + areOGImagesStaticallyOptimized: STATICALLY_OPTIMIZED_OG_IMAGES, isBlurEnabled: BLUR_ENABLED, isGeoPrivacyEnabled: GEO_PRIVACY_ENABLED, isAiTextGenerationEnabled: AI_TEXT_GENERATION_ENABLED,