diff --git a/projects/wp-nextjs-app/src/app/(single)/[...path]/page.tsx b/projects/wp-nextjs-app/src/app/(single)/[...path]/page.tsx index 665d61aaa..23b1c92df 100644 --- a/projects/wp-nextjs-app/src/app/(single)/[...path]/page.tsx +++ b/projects/wp-nextjs-app/src/app/(single)/[...path]/page.tsx @@ -9,6 +9,7 @@ import { import { Metadata } from 'next'; import { removeSourceUrl } from '@headstartwp/core'; import dynamic from 'next/dynamic'; +import { FC, Suspense } from 'react'; import Blocks from '../../../components/Blocks'; const ClientRelatedPosts = dynamic(() => @@ -52,6 +53,26 @@ export async function generateMetadata({ params }: HeadstartWPRoute): Promise = async ({ + post_id, + category, +}) => { + const { data } = await queryPosts({ + params: { postType: 'post', per_page: 3, category, exclude: [post_id] }, + }); + + return ( +
+

Related Posts (Streamed from Server)

+ +
+ ); +}; + const Single = async ({ params }: HeadstartWPRoute) => { const { data, seo, config } = await query({ params }); @@ -66,10 +87,18 @@ const Single = async ({ params }: HeadstartWPRoute) => { {seo.schema && } {data.post.terms.category && ( - + <> + + + + + )} ); diff --git a/projects/wp-nextjs-app/src/components/RelatedPosts.tsx b/projects/wp-nextjs-app/src/components/RelatedPosts.tsx index fff864f15..82b7488e5 100644 --- a/projects/wp-nextjs-app/src/components/RelatedPosts.tsx +++ b/projects/wp-nextjs-app/src/components/RelatedPosts.tsx @@ -9,7 +9,7 @@ type Props = { }; export const RelatedPosts: React.FC = ({ category, post_id }) => { - const { data, loading } = useFetchPosts({ per_page: 3, category, exclude: post_id }); + const { data, loading } = useFetchPosts({ per_page: 3, category, exclude: [post_id] }); if (loading) { return
Loading...
;