Changes to get the image to build
This commit is contained in:
parent
43bfdcdb93
commit
baff1bc812
|
|
@ -7,6 +7,8 @@ import { Separator } from "@/components/ui/separator";
|
|||
import { getPosts, getSinglePost, processHtmlContent } from "@/lib/blog/query";
|
||||
import type { Author, Post } from "@/types/blog";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
type PageProps = {
|
||||
params: Promise<{ slug: string }>;
|
||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
|
|
@ -56,12 +58,16 @@ export async function generateMetadata({
|
|||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const data = await getPosts();
|
||||
if (!data || !data.posts.length) return [];
|
||||
try {
|
||||
const data = await getPosts();
|
||||
if (!data || !data.posts.length) return [];
|
||||
|
||||
return data.posts.map((post) => ({
|
||||
slug: post.slug,
|
||||
}));
|
||||
return data.posts.map((post) => ({
|
||||
slug: post.slug,
|
||||
}));
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export default async function BlogPostPage({ params }: PageProps) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import { Separator } from "@/components/ui/separator";
|
|||
import { getPosts } from "@/lib/blog/query";
|
||||
import type { Post } from "@/types/blog";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Blog - OpenCut",
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,15 @@ import { SITE_URL } from "@/constants/site-constants";
|
|||
import { getPosts } from "@/lib/blog/query";
|
||||
import type { MetadataRoute } from "next";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
const data = await getPosts();
|
||||
let data: Awaited<ReturnType<typeof getPosts>> | null = null;
|
||||
try {
|
||||
data = await getPosts();
|
||||
} catch {
|
||||
// CMS unavailable (e.g. during build), skip blog posts in sitemap
|
||||
}
|
||||
|
||||
const postPages: MetadataRoute.Sitemap =
|
||||
data?.posts?.map((post) => ({
|
||||
|
|
|
|||
Loading…
Reference in New Issue