Skip to content

Commit

Permalink
#161 SEO 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaeyeon1 committed Dec 14, 2023
1 parent a76ca8d commit 264ef45
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
22 changes: 16 additions & 6 deletions client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import PostData from '@/components/Post/PostData';
import { SERVER_URL } from '@/constant/common';
import { Metadata } from 'next';
import Head from 'next/head';
import React from 'react';

const getData = async (id: number) => {
const res = await fetch(
`http://glogglogglog-env.eba-fuksumx7.ap-northeast-2.elasticbeanstalk.com/post?postId=${id}`,
);
const res = await fetch(`${SERVER_URL}/post?postId=${id}`);
return res.json();
};

Expand All @@ -15,17 +15,27 @@ export const generateMetadata = async ({
params: { id: string };
}): Promise<Metadata> => {
const data = await getData(Number(params.id));

return {
title: data.title,
description: data.content,
openGraph: {
title: data.title,
description: data.content,
},
};
};

function page({ params }: { params: { blogName: string; categoryId: string; postId: string } }) {
return (
<PostData
params={{ blogName: params.blogName, categoryId: params.categoryId, postId: params.postId }}
/>
<>
<Head>
<title key={'title'}>{`${params.blogName} | Next Movies`}</title>
</Head>
<PostData
params={{ blogName: params.blogName, categoryId: params.categoryId, postId: params.postId }}
/>
</>
);
}

Expand Down
1 change: 0 additions & 1 deletion client/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const metadata: Metadata = {
title: 'GLOG',
description:
'개발자들을 위해 만들어진 블로그를 작성해보세요! 발자국 시스템, PR 시스템으로 블로그를 꾸준히 쓸 수 있도록 도와줍니다',
images: 'http://15.164.221.35:3000',
},
icons: [{ rel: 'icon', url: Favicon.src }],
};
Expand Down
3 changes: 3 additions & 0 deletions client/src/constant/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ export const OAUTH2_REDIRECT_URI = 'http://15.164.221.35:3000/oauth2/redirect';

export const GITHUB_AUTH_URL =
API_BASE_URL + '/oauth2/authorization/github?redirect_uri=' + OAUTH2_REDIRECT_URI;

export const SERVER_URL =
'http://glogglogglog-env.eba-fuksumx7.ap-northeast-2.elasticbeanstalk.com';

0 comments on commit 264ef45

Please sign in to comment.