mirror of
https://github.com/Hackdex-App/hackdex-website.git
synced 2026-06-10 09:20:44 -05:00
Add ISR to hack detail pages
This commit is contained in:
parent
c598773411
commit
5b3cd051c1
|
|
@ -9,7 +9,7 @@ import rehypeSlug from "rehype-slug";
|
|||
import Image from "next/image";
|
||||
import { FaDiscord, FaTwitter, FaTriangleExclamation } from "react-icons/fa6";
|
||||
import PokeCommunityIcon from "@/components/Icons/PokeCommunityIcon";
|
||||
import { createClient } from "@/utils/supabase/server";
|
||||
import { createClient, createServiceClient } from "@/utils/supabase/server";
|
||||
import { getMinioClient, PATCHES_BUCKET } from "@/utils/minio/server";
|
||||
import HackOptionsMenu from "@/components/Hack/HackOptionsMenu";
|
||||
import DownloadsBadge from "@/components/Hack/DownloadsBadge";
|
||||
|
|
@ -23,6 +23,22 @@ interface HackDetailProps {
|
|||
params: Promise<{ slug: string }>;
|
||||
}
|
||||
|
||||
export const revalidate = 60 * 60; // 1 hour
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const supabase = await createServiceClient();
|
||||
const { data: hacks } = await supabase
|
||||
.from("hacks")
|
||||
.select("slug")
|
||||
.eq("approved", true)
|
||||
.order("downloads", { ascending: false })
|
||||
.limit(100); // Pre-render top 100 most popular hacks
|
||||
|
||||
return (hacks || []).map((hack) => ({
|
||||
slug: hack.slug,
|
||||
}));
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: HackDetailProps): Promise<Metadata> {
|
||||
const { slug } = await params;
|
||||
const supabase = await createClient();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user