Generate static tag params

This commit is contained in:
Sam Becker 2023-09-20 22:08:00 -05:00
parent c7fdfd1df2
commit 682d331141

View File

@ -1,6 +1,7 @@
import { getPhotosCached } from '@/cache';
import SiteGrid from '@/components/SiteGrid';
import PhotoGrid from '@/photo/PhotoGrid';
import { getUniqueTags } from '@/services/postgres';
import { absolutePathForTag, absolutePathForTagImage } from '@/site/paths';
import { descriptionForTaggedPhotos, titleForTag } from '@/tag';
import TagHeader from '@/tag/TagHeader';
@ -10,6 +11,13 @@ interface TagProps {
params: { tag: string }
}
export async function generateStaticParams() {
const tags = await getUniqueTags();
return tags.map(tag => ({
params: { tag },
}));
}
export async function generateMetadata({
params: { tag },
}: TagProps): Promise<Metadata> {