Statically generate grid, [photoId] paths

This commit is contained in:
Sam Becker 2023-09-20 14:51:26 -05:00
parent 590821e3dc
commit 57c137cee6
2 changed files with 12 additions and 2 deletions

View File

@ -8,7 +8,8 @@ import { getPhotos, getPhotosCount, getUniqueTags } from '@/services/postgres';
import PhotoTag from '@/tag/PhotoTag';
import { Metadata } from 'next';
export const runtime = 'edge';
// Revalidate every 12 hours
export const revalidate = 43_200;
export async function generateMetadata(): Promise<Metadata> {
const photos = await getPhotos();

View File

@ -6,6 +6,7 @@ import {
import { Metadata } from 'next';
import {
getPhoto,
getPhotos,
getPhotosTakenAfterPhotoInclusive,
getPhotosTakenBeforePhoto,
} from '@/services/postgres';
@ -13,7 +14,15 @@ import { redirect } from 'next/navigation';
import { absolutePathForPhoto, absolutePathForPhotoImage } from '@/site/paths';
import PhotoDetailPage from '@/photo/PhotoDetailPage';
export const runtime = 'edge';
// Revalidate every 12 hours
export const revalidate = 43_200;
export async function generateStaticParams() {
const photos = await getPhotos();
return photos.map(photo => ({
slug: photo.id,
}));
}
export async function generateMetadata({
params: { photoId },