Gatsby×ブログ - .mdxでTwitterやYouTubeを埋め込む
— Gatsby — 1 min read
Gatsby Plugin MDX Embed
基本はここのサイトに書いてあることをやる.
こちらのヘルプページ(英語)も参考に
インストール
1npm install mdx-embed gatsby-plugin-mdx-embed --save --legacy-peer-deps
設定
gatsby.config.js
1module.exports = {2 plugins: [3 `gatsby-plugin-mdx-embed`,4 ]5}
設定できない時:プラグイン記事(英語)
投稿記事での使い方
投稿記事
1<Tweet tweetLink="jack/status/20" />
他の設定についてはこちら(英語ページ)
YouTube
投稿記事
1<YouTube youTubeId="jNQXAC9IVRw" />
他の設定についてはこちら(英語ページ)
他の埋め込み
CodePen,Instagram,Spotify...
他にも多くの外部サービスを埋め込むことができる
— Gatsby —