-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat: blog-config에 lang, mainOgImage 추가 * Refactor: SEOConfigType과 ConfigType분리 * Fix: GatsbyImageDataType제거 -> GatsbyImageDataType * Refactor: Image component에서 useStaticImageProps hooks분리 * Fix: GatsbyImageDataType제거 -> GatsbyImageDataType * Feat: seo컴포넌트에 useStaticImage 적용 * Docs: blog config에서 favicon을 제외한 이미지 경로제거 * Chore: main-og-image변경 * docs: 리드미 업데이트
- Loading branch information
1 parent
17fdb75
commit 5e1545e
Showing
14 changed files
with
129 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ SEO, 웹접근성 | |
|
||
- [SEO, 웹 접근성](https://github.com/kimyouknow/kimyouknow.github.io/pull/15) | ||
- [Slack에 메타 태그가 적용되지 않는 버그 수정](https://github.com/kimyouknow/kimyouknow.github.io/pull/27) | ||
- [SEO 컴포넌트 리팩토링 및 og:image 에러 수정](https://github.com/kimyouknow/kimyouknow.github.io/pull/31) | ||
|
||
기타 | ||
|
||
|
@@ -113,13 +114,15 @@ Github에서 아래와 같이 세팅 후 원하는 main브랜치에 push하면 | |
|
||
```js | ||
{ | ||
lang: "", // ko | ||
title: ``, //Yunho.blog | ||
author: '', // Yunho(kimyouknow) | ||
description: ``, // 안녕하세요. 프론트엔드 개발자 김윤호입니다. 고민과 문제 해결 과정을 공유하고 있습니다. | ||
siteUrl: '', // https://kimyouknow.github.io/ | ||
image: ``, // static 경로에 원하는 사진을 넣어주시면 프로필 이미지로 반영됩니다. ex) ./static/profile-image.png | ||
profileImage: ``, // static 경로에 있는 사진 파일을 입력하면 프로필 이미지로 반영됩니다. ex) profile-image.png | ||
mainOgImage :"", // static 경로에 원하는 사진 파일을 입력하면 메인페이지의 og-image 태그로 반영됩니다. | ||
keywords: [], // 원하는 키워드를 적어주시면 keywords meta태그에 반영됩니다. ex) '개발블로그', '문제해결', 'gatsby' | ||
favicon: '', // static 경로에 원하는 사진을 넣어주시면 favicon 이미지로 반영됩니다. ex) ./static/pencil.png | ||
favicon: '', // static 경로에 원하는 사진을 넣어주시면 favicon 이미지로 반영됩니다. ex) /static/pencil.png | ||
social: { | ||
email: '', // [email protected] | ||
github: ``, //https://github.com/kimyouknow | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { graphql, useStaticQuery } from 'gatsby' | ||
import { IGatsbyImageData } from 'gatsby-plugin-image' | ||
import { useMemo } from 'react' | ||
|
||
interface ImageNode { | ||
node: { | ||
relativePath: string | ||
extension: string | ||
publicURL: string | ||
childImageSharp: { | ||
gatsbyImageData: IGatsbyImageData | ||
} | ||
} | ||
} | ||
|
||
interface AssetsImageType { | ||
images: { | ||
edges: ImageNode[] | ||
} | ||
} | ||
|
||
export interface useStaticImageProps { | ||
src: string | ||
} | ||
|
||
const useStaticImage = ({ src }: useStaticImageProps) => { | ||
const assetImages = useStaticQuery<AssetsImageType>(imageQuery) | ||
|
||
const target = useMemo( | ||
() => assetImages.images.edges.find(({ node }) => src === node.relativePath), | ||
[assetImages, src], | ||
) | ||
|
||
return target | ||
} | ||
|
||
export default useStaticImage | ||
|
||
const imageQuery = graphql` | ||
query { | ||
images: allFile(filter: { sourceInstanceName: { eq: "static" } }) { | ||
edges { | ||
node { | ||
relativePath | ||
extension | ||
publicURL | ||
childImageSharp { | ||
gatsbyImageData(layout: CONSTRAINED) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.