Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/#12 #98

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions app/(docs)/docs/[title]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { docsQuery } from "@/services/docs/docs.query";
import { likeQuery } from "@/services/like/like.query";
import { Metadata } from "next";
import { generateOpenGraph } from "@/utils";
import { notFound } from "next/navigation";
import Docs from "./Docs";

interface PageProps {
Expand All @@ -15,17 +14,13 @@ interface PageProps {
}

export const generateMetadata = async ({ params: { title } }: PageProps): Promise<Metadata> => {
try {
const queryClient = getQueryClient();
const data = await queryClient.fetchQuery(docsQuery.title(title));
const queryClient = getQueryClient();
const data = await queryClient.fetchQuery(docsQuery.title(title));

return generateOpenGraph({
title: data.title,
description: data.contents,
});
} catch {
notFound();
}
return generateOpenGraph({
title: data.title,
description: data.contents,
});
};

const Page = async ({ params: { title } }: PageProps) => {
Expand Down
3 changes: 2 additions & 1 deletion utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export const generateOpenGraph = <OG extends { title: string; description: strin
type: "website",
title: `부마위키 - ${title}`,
description,
images: "/meta-img.png",
images:
"https://bumawiki.s3.ap-northeast-2.amazonaws.com/file2a809fd7-66f4-421e-9b64-005b34ea8020",
},
});

Expand Down