File tree Expand file tree Collapse file tree 11 files changed +76
-2
lines changed
Expand file tree Collapse file tree 11 files changed +76
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ import { getQuestions } from "@/lib/actions/question.action";
1515import { HomePageFilters } from "@/constants/filters" ;
1616
1717import type { SearchParamsProps } from "@/types" ;
18+ import type { Metadata } from "next" ;
19+
20+ export const metadata : Metadata = {
21+ title : "Home — DevOverflow" ,
22+ } ;
1823
1924export default async function Home ( { searchParams } : SearchParamsProps ) {
2025 const { userId : clerkId } = auth ( ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,11 @@ import { auth } from "@clerk/nextjs";
33import Question from "@/components/forms/Question" ;
44
55import { getUserById } from "@/lib/actions/user.action" ;
6+ import type { Metadata } from "next" ;
7+
8+ export const metadata : Metadata = {
9+ title : "Ask a Question — DevOverflow" ,
10+ } ;
611
712type Props = { } ;
813
Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ import { getSavedQuestions } from "@/lib/actions/user.action";
1111import { QuestionFilters } from "@/constants/filters" ;
1212
1313import type { SearchParamsProps } from "@/types" ;
14+ import type { Metadata } from "next" ;
15+
16+ export const metadata : Metadata = {
17+ title : "Collection — DevOverflow" ,
18+ } ;
1419
1520export default async function Collection ( { searchParams } : SearchParamsProps ) {
1621 const { userId : clerkId } = auth ( ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ import { getAllUsers } from "@/lib/actions/user.action";
99import { UserFilters } from "@/constants/filters" ;
1010
1111import type { SearchParamsProps } from "@/types" ;
12+ import type { Metadata } from "next" ;
13+
14+ export const metadata : Metadata = {
15+ title : "Community — DevOverflow" ,
16+ } ;
1217
1318const Page = async ( { searchParams } : SearchParamsProps ) => {
1419 const result = await getAllUsers ( {
Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ import Answer from "@/components/forms/Answer";
77import { getAnswerById } from "@/lib/actions/answer.action" ;
88
99import type { ParamsProps } from "@/types" ;
10+ import type { Metadata } from "next" ;
11+
12+ export const metadata : Metadata = {
13+ title : "Edit Answer — DevOverflow" ,
14+ } ;
1015
1116const Page = async ( { params } : ParamsProps ) => {
1217 const { userId } = auth ( ) ;
Original file line number Diff line number Diff line change @@ -10,10 +10,21 @@ import Stats from "@/components/shared/Stats";
1010import AnswersTab from "@/components/shared/AnswersTab" ;
1111import QuestionsTab from "@/components/shared/QuestionsTab" ;
1212
13- import { getUserInfo } from "@/lib/actions/user.action" ;
13+ import { getUserInfo , getUserById } from "@/lib/actions/user.action" ;
1414import { getFormattedJoinedDate } from "@/lib/utils" ;
1515
1616import type { URLProps } from "@/types" ;
17+ import type { Metadata } from "next" ;
18+
19+ export async function generateMetadata ( {
20+ params,
21+ } : Omit < URLProps , "searchParams" > ) : Promise < Metadata > {
22+ const user = await getUserById ( { userId : params . id } ) ;
23+
24+ return {
25+ title : `${ user . username } 's Profile — DevOverflow` ,
26+ } ;
27+ }
1728
1829const Page = async ( { params, searchParams } : URLProps ) => {
1930 const { userId : clerkId } = auth ( ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ import Profile from "@/components/forms/Profile";
55import { getUserById } from "@/lib/actions/user.action" ;
66
77import type { ParamsProps } from "@/types" ;
8+ import type { Metadata } from "next" ;
9+
10+ export const metadata : Metadata = {
11+ title : "Edit Profile — DevOverflow" ,
12+ } ;
813
914const Page = async ( { params } : ParamsProps ) => {
1015 const { userId } = auth ( ) ;
Original file line number Diff line number Diff line change @@ -18,6 +18,17 @@ import { getQuestionById } from "@/lib/actions/question.action";
1818import { getFormattedNumber , getTimestamp } from "@/lib/utils" ;
1919
2020import type { URLProps } from "@/types" ;
21+ import type { Metadata } from "next" ;
22+
23+ export async function generateMetadata ( {
24+ params,
25+ } : Omit < URLProps , "searchParams" > ) : Promise < Metadata > {
26+ const question = await getQuestionById ( { questionId : params . id } ) ;
27+
28+ return {
29+ title : `"${ question . title } " — DevOverflow` ,
30+ } ;
31+ }
2132
2233const Page = async ( { params, searchParams } : URLProps ) => {
2334 const { userId : clerkId } = auth ( ) ;
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ import { getQuestionById } from "@/lib/actions/question.action";
66import { getUserById } from "@/lib/actions/user.action" ;
77
88import type { ParamsProps } from "@/types" ;
9+ import type { Metadata } from "next" ;
10+
11+ export const metadata : Metadata = {
12+ title : "Edit Question — DevOverflow" ,
13+ } ;
914
1015const Page = async ( { params } : ParamsProps ) => {
1116 const { userId } = auth ( ) ;
Original file line number Diff line number Diff line change @@ -5,9 +5,21 @@ import NoResult from "@/components/shared/NoResult";
55import Pagination from "@/components/shared/Pagination" ;
66import LocalSearchbar from "@/components/shared/search/LocalSearchbar" ;
77
8- import { getQuestionsByTagId } from "@/lib/actions/tag.action" ;
8+ import { getTagById , getQuestionsByTagId } from "@/lib/actions/tag.action" ;
99
1010import type { URLProps } from "@/types" ;
11+ import type { Metadata } from "next" ;
12+
13+ export async function generateMetadata ( {
14+ params,
15+ } : Omit < URLProps , "searchParams" > ) : Promise < Metadata > {
16+ const tag = await getTagById ( { tagId : params . id } ) ;
17+
18+ return {
19+ title : `Posts by tag '${ tag . name } ' — DevOverflow` ,
20+ description : tag . description || `Questions tagged with ${ tag . name } ` ,
21+ } ;
22+ }
1123
1224const Page = async ( { params, searchParams } : URLProps ) => {
1325 const { userId : clerkId } = auth ( ) ;
You can’t perform that action at this time.
0 commit comments