notion API + NEXT.js + netlify でブログ立ち上げ ⑦ 動的OGP

notion API + NEXT.js + netlify でブログ立ち上げ ⑦ 動的OGP
codeが凄いシンプルでカスタマイズしやすい
まずは開発するためにCONTRIBUTING.mdを参照
Clone this repo with git clone <https://github.com/vercel/og-image> Change directory with cd og-image Run yarn or npm install to install all dependencies Run locally with vercel dev and visit localhost:3000 (if nothing happens, run npm install -g vercel) If necessary, edit the exePath in options.ts to point to your local Chrome executable
シンプルですね。 この通りに実行してみます。 vercelは今回はローカルインストールにしようと思います。
yarn install
yarn install --dev vercel
yarn vercel dev
yarn install --dev vercel このタイミングで、vercelにcliログインするよう案内されるのでそのとおりに。
$ yarn vercel dev
yarn run v1.22.15
Vercel CLI 24.0.0
> Creating initial build
Running "yarn run build"
warning ../../../../package.json: No license field
$ tsc -p api/tsconfig.json && tsc -p web/tsconfig.json
> Success! Build completed
> Ready! Available at http://localhost:3000
画像生成用urlを扱うだけじゃなくて、そのurlを作るための画面も用意されてる、便利ですね。

カスタマイズ

ここからカスタマイズしていきます。 おおよそ揃ってるのであまりすることもないのですが、下記対応を行います。
  1. 背景に画像を入れれるようにする
  2. 日本語入力ができるようにする