Notion API 노션 이미지 가져오기

KoEunseo·2023년 2월 7일
0

portfolio

목록 보기
6/12

project img source

이미지 경로 확인해서 가져온다.
예시에서는 커버사진을 가져오는데, 커버사진이 외부 도메인에서 가져오거나 파일로 가져오기 때문에 아래와 같이 담는다.

const description = data.properties.Description.rich_text[0].plain_text
const img = data.cover.external.url || data.cover.file?.url

next.config.js

external url을 등록한다.

const nextConfig = {
  reactStrictMode: true,
  images: {
    domains: [
      "www.notion.so",
      "images.unsplash.com",
      "s3.us-west-2.amazonaws.com"
    ]
  }
}
profile
주니어 플러터 개발자의 고군분투기

0개의 댓글