File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -3,17 +3,27 @@ import {
3
3
getFeaturedMediaById ,
4
4
getAuthorById ,
5
5
getCategoryById ,
6
+ getAllPosts ,
6
7
} from "@/lib/wordpress" ;
7
8
8
9
import { Section , Container , Article , Prose } from "@/components/craft" ;
9
- import { Metadata } from "next" ;
10
10
import { badgeVariants } from "@/components/ui/badge" ;
11
11
import { cn } from "@/lib/utils" ;
12
12
import { siteConfig } from "@/site.config" ;
13
13
14
14
import Link from "next/link" ;
15
15
import Balancer from "react-wrap-balancer" ;
16
16
17
+ import type { Metadata } from "next" ;
18
+
19
+ export async function generateStaticParams ( ) {
20
+ const posts = await getAllPosts ( ) ;
21
+
22
+ return posts . map ( ( post ) => ( {
23
+ slug : post . slug ,
24
+ } ) ) ;
25
+ }
26
+
17
27
export async function generateMetadata ( {
18
28
params,
19
29
} : {
@@ -65,7 +75,9 @@ export default async function Page({
65
75
} ) {
66
76
const { slug } = await params ;
67
77
const post = await getPostBySlug ( slug ) ;
68
- const featuredMedia = post . featured_media ? await getFeaturedMediaById ( post . featured_media ) : null ;
78
+ const featuredMedia = post . featured_media
79
+ ? await getFeaturedMediaById ( post . featured_media )
80
+ : null ;
69
81
const author = await getAuthorById ( post . author ) ;
70
82
const date = new Date ( post . date ) . toLocaleDateString ( "en-US" , {
71
83
month : "long" ,
You can’t perform that action at this time.
0 commit comments