Skip to content

Commit

Permalink
fix : og 태그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepdog13 committed Mar 1, 2024
1 parent 5b1a74b commit 2e9d19c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
38 changes: 21 additions & 17 deletions client/src/components/common/MetaTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { Helmet } from "react-helmet-async";

function MetaTag(props) {
const { type = "home", title, desc, img } = props;
const { type = "home", title, desc, img, url } = props;
return type === "home" ? (
<Helmet>
<title>sheepdog13blog</title>
Expand All @@ -11,10 +11,9 @@ function MetaTag(props) {
name="description"
content="자바스크립트를 주로 다루는 기술 블로그입니다."
/>
<meta name="keywords" content="blog" />
<meta property="og:type" content="website" />
<meta property="og:title" content="sheepdog13" />
<meta property="og:site_name" content="sheepdog13" />
<meta property="og:title" content="sheepdog13 | 블로그" />
<meta property="og:site_name" content="sheepdog13 | 블로그" />
<meta
property="og:description"
content="자바스크립트를 주로 다루는 기술 블로그입니다."
Expand All @@ -23,21 +22,26 @@ function MetaTag(props) {
property="og:image"
content="https://sheepdog13.blog/img/bond.webp"
/>
<meta property="og:url" content="https://sheepdog13.blog" />
<meta property="og:url" content="https://sheepdog13.blog/" />
</Helmet>
) : (
<Helmet>
<title>{title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content={desc} />
<meta name="keywords" content="post" />
<meta property="og:type" content="website" />
<meta property="og:title" content={title} />
<meta property="og:site_name" content={title} />
<meta property="og:description" content={desc} />
<meta property="og:image" content={`https://sheepdog13.blog${img}`} />
<meta property="og:url" content={window.location.href} />
</Helmet>
<>
{title && (
<Helmet>
<title>{title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content={title} />
<meta
property="og:url"
content={`https://sheepdog13.blog/post/${url}`}
/>
<meta property="og:type" content="website" />
<meta property="og:site_name" content={title} />
<meta name="og:description" content={desc} />
<meta property="og:image" content={`https://sheepdog13.blog${img}`} />
</Helmet>
)}
</>
);
}

Expand Down
3 changes: 2 additions & 1 deletion client/src/components/views/PostPage/PostPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,15 @@ function PostPage() {
};
getMarkdown(failename);
}, [failename]);

console.log(failename);
return (
<>
<MetaTag
type="posting"
title={markdownData?.title}
desc={markdownData?.title}
img={markdownData?.imgpath}
url={failename}
/>
<Header />
<Wrapper>
Expand Down

0 comments on commit 2e9d19c

Please sign in to comment.