Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nuxt.jsとFirebaseで個人開発した話

Kenji Kawanobe
September 07, 2022
70

 Nuxt.jsとFirebaseで個人開発した話

Kenji Kawanobe

September 07, 2022
Tweet

Transcript

  1. 使用技術 • フロント:#Nuxt.js #TypeScript #Vuetify • バック:#Firebase Functions #Node.js •

    認証:#Firebase Authentification • DB:#Firestore #Algoria(Firebase Extensions) • ストレージ:#Firebase Storage • ホスティング:#Firebase Hsoting #Google App Engine
  2. Nuxt.jsでOGPを設定 • head()関数で設定可能 ◦ https://nuxtjs.org/docs/features/ configuration#local-settings • og:imageで画像URLを指定することによっ て、ページURLを共有する際に画像を表示 できる

    ◦ 画像はどうやって生成するの? <script> export default { head() { return { meta: [ { hid: 'og:description', property: 'og:description', content: '説明' }, { hid: 'og:url', property: 'og:url', content: 'ページURL' }, { hid: 'og:image', property: 'og:image', content: '画像URL' }, ] } } }; </script>
  3. Firebase Functions で OGP用の画像生成 • 記事投稿時にFirebase Functionsを実行 ◦ Firebase FunctionsでOGP用の画像を生成

    ▪ canvasを利用して画像生成 • https://github.com/Automattic/node-canvas ▪ 生成した画像はFirebase Storageに保存 ▪ 保存先URLを投稿ごとに管理できるようFirestoreに登録 • 各投稿ページのSSR時に、Firestoreに登録されたURLをOGPに設定