- 5/18 から Gatsby.js を書き始めた
- つまづいて、調べて解決した点をメモっていく
- 言語学習の過程が記録として残る
- 間違っている可能性が大いにあるので、この記事は自分向けです
導入
Quick Start | GatsbyJS を見ながら進めれば難なくできます
npm install -g gatsby-cli
gatsby new gatsby-site
cd gatsby-site
# Start development server.
gatsby develop
# Create a production build.
gatsby build
# Serve the production build locally.
gatsby serve
GitHub pages にデプロイ
gh-pages をインストールする
yarn add --dev gh-pages
yarn deploy でデプロイできるように以下を追加
{
"scripts": {
...
"deploy": "gatsby build && gh-pages -d public -b master",
}
}
ロゴなどを配置する
- パスを固定したいものはルート直下の static に配置する
- static 直下に置いたものがホスティングの際のルートパス直下に配置される形でコピーが走る
- Twitter カード向けの画像などは現実的に static 下に置く形となりそう?
Meta タグの設定をいい感じにやりたい
yarn add gatsby-plugin-react-helmet react-helmet
gatsby-config.js に以下を追加
{
plugins: [`gatsby-plugin-react-helmet`]
}
より実践的な OGP や Twitter カードの設定などは Adding an SEO component | GatsbyJS を参照
ソーシャルメディアシェアボタンの設置
npm install react-share --save
コンポーネント
import {
FacebookShareButton,
LinkedinShareButton,
TwitterShareButton,
TelegramShareButton,
WhatsappShareButton,
PinterestShareButton,
VKShareButton,
OKShareButton,
RedditShareButton,
TumblrShareButton,
LivejournalShareButton,
MailruShareButton,
ViberShareButton,
WorkplaceShareButton,
LineShareButton,
PocketShareButton,
InstapaperShareButton,
EmailShareButton,
} from 'react-share';
Pinned Articles
About
ウェブ界隈でエンジニアとして労働活動に励んでいる @gomi_ningen 個人のブログです
Tags
JavaScript
PowerShell
kibana
elasticsearch
fluentd
nginx
イベント
五十嵐裕美
村川梨衣
logrotate
IoT
Scala
Java
C言語
iputils
ICMP
WUG
mastodon
Swift
AWS
Clock
Windows
アーキテクチャ
PoEAA
iOS
DeviceFarm
プログラミング言語
OS
StepFunctions
Lambda
Serverless
terraform
ポエム
RHEL
ネットワーク
GraphQL
CloudWatch
Linux
Coreutils
network
nc
telnet
LinuxKernel
fpinscala
ELB
IAM
AppSync
EFS
Gradle
english