Skip to content

Commit

Permalink
fix: sns 공유 시 공유 url이 들어있지 않던 문제 해결 (#95)
Browse files Browse the repository at this point in the history
빌드 타임에 `location.href`가 존재하지 않아
sns 공유 링크 클릭시 공유 url이 `undefined`인
문제가 있었고 `siteMetadata.siteUrl`과 `location.pathname`을
조합하여 url을 구성하게 함으로써 문제를 해결함

Signed-off-by: chayeoi <[email protected]>
  • Loading branch information
chayeoi committed Mar 4, 2020
1 parent cbffac1 commit 57c07ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/templates/blog-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const BlogPost: React.FC<Props> = ({ data, location, pageContext }) => {
<footer>
<SocialShare
frontmatter={data.mdx.frontmatter}
url={location.href}
url={`${data.site.siteMetadata.siteUrl}${location.pathname}`}
/>
<Profile css={s.profile} />
<PostNavigation pageContext={pageContext} />
Expand Down

0 comments on commit 57c07ff

Please sign in to comment.