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 cef6f2b commit 2d21021
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
6 changes: 0 additions & 6 deletions client/src/app/[blogName]/home/[categoryId]/[postId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import { AddLikeApi, DeleteWriteApi } from '@/api/write-api';
import { enqueueSnackbar } from 'notistack';
import ThumbUpIcon from '@mui/icons-material/ThumbUp';
import { postVisitApi } from '@/api/mypage-api';
import SEO from '@/components/SEO';

const page = ({ params }: { params: { blogName: string; categoryId: string; postId: string } }) => {
const { data: blogIdData } = usegetblogIdQuery({ blogUrl: params.blogName });
Expand Down Expand Up @@ -177,11 +176,6 @@ const page = ({ params }: { params: { blogName: string; categoryId: string; post

return (
<Stack>
<SEO
title={post?.title}
description={post?.content?.slice(0, 30)}
ogImage={{ url: post?.thumbnail ?? '', width: 1200, height: 630 }}
/>
<ThumbnailArea>
<ImageContainer
imageSrc={
Expand Down
15 changes: 15 additions & 0 deletions client/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ import ThemeRegistry from '@/components/ReactQuery/ThemeRegistry';
import ReactQuery from '@/components/ReactQuery/Provider';
import Header from '@/components/Layout/Header';
import FullLayout from '@/components/Layout/FullLayout';
import { Metadata } from 'next';
import Favicon from '/public/assets/yellowFootPrint.png';

export const metadata: Metadata = {
title: 'GLOG',
description:
'개발자들을 위해 만들어진 블로그를 작성해보세요! 발자국 시스템, PR 시스템으로 블로그를 꾸준히 쓸 수 있도록 도와줍니다',
openGraph: {
title: 'GLOG',
description:
'개발자들을 위해 만들어진 블로그를 작성해보세요! 발자국 시스템, PR 시스템으로 블로그를 꾸준히 쓸 수 있도록 도와줍니다',
images: 'http://15.164.221.35:3000',
},
icons: [{ rel: 'icon', url: Favicon.src }],
};

export default function RootLayout(props: { children: ReactNode }) {
const { children } = props;
Expand Down
11 changes: 11 additions & 0 deletions client/src/app/robots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { MetadataRoute } from 'next';

export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
allow: '/',
},
sitemap: 'http://15.164.221.35:3000/sitemap.xml',
};
}
27 changes: 27 additions & 0 deletions client/src/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// import { useGetCollectDataQuery } from '@/api/collect-api';
import { MetadataRoute } from 'next';

export default function sitemap(): MetadataRoute.Sitemap {
// const { data } = useGetCollectDataQuery({ kind: 'likes', page: 0 });
// const allThePostData = data?.postPreviewDtos;

// const sitemapUrls = allThePostData.map((post) => {
// return {
// url: `http://15.164.221.35:3000/${post.blogUrl}/home/${post.categoryId}/${post.postId}`,
// };
// });

const staticUrls = [
{
url: 'http://15.164.221.35:3000',
},
{
url: 'http://15.164.221.35:3000/jkjk',
},
{
url: 'http://15.164.221.35:3000/jkjk/home/5/45',
},
];

return [...staticUrls];
}

0 comments on commit 2d21021

Please sign in to comment.