Generate static params for photo detail pages
This commit is contained in:
parent
4d4e4fff54
commit
4887f93bfc
@ -1,4 +1,5 @@
|
||||
import {
|
||||
GENERATE_STATIC_PARAMS_LIMIT,
|
||||
GRID_THUMBNAILS_TO_SHOW_MAX,
|
||||
descriptionForPhoto,
|
||||
titleForPhoto,
|
||||
@ -12,8 +13,13 @@ import {
|
||||
} from '@/site/paths';
|
||||
import PhotoDetailPage from '@/photo/PhotoDetailPage';
|
||||
import { getPhotoCached, getPhotosNearIdCached } from '@/cache';
|
||||
import { getPhotos } from '@/services/vercel-postgres';
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const photos = await getPhotos({ limit: GENERATE_STATIC_PARAMS_LIMIT });
|
||||
return photos.map(({ id }) => ({ photoId: id }));
|
||||
}
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
interface PhotoProps {
|
||||
params: { photoId: string }
|
||||
|
||||
@ -11,6 +11,8 @@ import {
|
||||
import camelcaseKeys from 'camelcase-keys';
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
export const GENERATE_STATIC_PARAMS_LIMIT = 1000;
|
||||
|
||||
export const PHOTO_LOAD_MULTIPLE_ROOT =
|
||||
process.env.NODE_ENV === 'development' ? 2 : 12;
|
||||
export const PHOTO_LOAD_MULTIPLE_GRID =
|
||||
|
||||
Loading…
Reference in New Issue
Block a user