{
    "componentChunkName": "component---src-templates-blog-post-jsx",
    "path": "/post/migrate-wp-to-middleman-and-netlify/",
    "result": {"data":{"site":{"siteMetadata":{"title":"WEB EGG","author":"Leko - CTO at Yuimedi"}},"markdownRemark":{"id":"2885469b-c98e-585f-91ff-72d39c0c8927","excerpt":"こんにちは。 「サイトのデザインが変わった」と感じていただいた方がもし居たらありがとうございます。 2012年からずっとさくらVPS + Wordpressで運用していたブログをMiddleman + Netlifyに置き換えたので、経緯や方法について残しておきます。 背景 そもそもなぜさくら+Wordpress…","html":"<p>こんにちは。<br>\n「サイトのデザインが変わった」と感じていただいた方がもし居たらありがとうございます。</p>\n<p>2012年からずっとさくらVPS + Wordpressで運用していたブログをMiddleman + Netlifyに置き換えたので、経緯や方法について残しておきます。</p>\n<!--more-->\n<h2 id=\"背景\" style=\"position:relative;\"><a href=\"#%E8%83%8C%E6%99%AF\" aria-label=\"背景 permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>背景</h2>\n<h3 id=\"そもそもなぜさくらwordpressだったのか\" style=\"position:relative;\"><a href=\"#%E3%81%9D%E3%82%82%E3%81%9D%E3%82%82%E3%81%AA%E3%81%9C%E3%81%95%E3%81%8F%E3%82%89wordpress%E3%81%A0%E3%81%A3%E3%81%9F%E3%81%AE%E3%81%8B\" aria-label=\"そもそもなぜさくらwordpressだったのか permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>そもそもなぜさくら+Wordpressだったのか</h3>\n<p>もう5年前のことなので記憶はあやふやですが。<br>\n当時の私はサーバサイド（PHPもシェルもWebサーバも含め）の理解が弱く、練習のために自前でサーバ立ててWP入れて運用を始めたんだと思います。</p>\n<p>ただ、かれこれ５年記事を書いていて思うのが、</p>\n<ul>\n<li>レビューの仕組みが辛い</li>\n<li>Markdownパーサがたまに不安定な挙動をしたり、未だ安心感がない</li>\n<li>Git管理できない（現在の開発方法では）</li>\n<li>見た目いじるのにいちいちWordpressのお作法に引きずられる</li>\n<li>WPのこと自体を覚えても今更金にならなくなってきた</li>\n<li>昨今のフロント事情について行くときにPHPが邪魔</li>\n<li>プラグインの中身にタッチできないので、HTMLやアセットの細かい制御しにくい</li>\n<li>記事のネタを管理する場所がなく、TODOリスト作っても管理が面倒</li>\n</ul>\n<p>などの背景があり、思い切って静的サイトに移し替えようと思いました</p>\n<h2 id=\"リニューアルで取り入れたいこと\" style=\"position:relative;\"><a href=\"#%E3%83%AA%E3%83%8B%E3%83%A5%E3%83%BC%E3%82%A2%E3%83%AB%E3%81%A7%E5%8F%96%E3%82%8A%E5%85%A5%E3%82%8C%E3%81%9F%E3%81%84%E3%81%93%E3%81%A8\" aria-label=\"リニューアルで取り入れたいこと permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>リニューアルで取り入れたいこと</h2>\n<ul>\n<li>HTTPS</li>\n<li>HTTP/2</li>\n<li>Github運用</li>\n<li>フロント周りの融通を効かせたい</li>\n<li>Bootstrap4</li>\n<li>BEM</li>\n<li>ゼロベースで自分でデザイン</li>\n</ul>\n<p>が主でした。<br>\n他にもAMPやらPWAやsw-precacheなど、フロントで試してみたい事は色々ありましたが、最低限上記は必須としました。</p>\n<p>ちなみにこのブログのソースはこちらから確認できます。<br>\n<a href=\"https://github.com/Leko/WEB-EGG\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Leko/WEB-EGG</a></p>\n<h2 id=\"想定するメリット\" style=\"position:relative;\"><a href=\"#%E6%83%B3%E5%AE%9A%E3%81%99%E3%82%8B%E3%83%A1%E3%83%AA%E3%83%83%E3%83%88\" aria-label=\"想定するメリット permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>想定するメリット</h2>\n<ul>\n<li>表示が早くなる</li>\n<li>記事を読みやすくできる</li>\n<li>サーバの運用レス（WPアップグレードしたらブログ落ちるなどが発生しなくなる）</li>\n<li>Githubを中心に自動化・効率化を入れて行ける</li>\n<li>画像の最適化など、事前ビルドできないと難しいことを簡単にやれる</li>\n</ul>\n<h2 id=\"想定するデメリットと対処法法\" style=\"position:relative;\"><a href=\"#%E6%83%B3%E5%AE%9A%E3%81%99%E3%82%8B%E3%83%87%E3%83%A1%E3%83%AA%E3%83%83%E3%83%88%E3%81%A8%E5%AF%BE%E5%87%A6%E6%B3%95%E6%B3%95\" aria-label=\"想定するデメリットと対処法法 permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>想定するデメリットと対処法法</h2>\n<h3 id=\"ブログ自体を作成するコスト\" style=\"position:relative;\"><a href=\"#%E3%83%96%E3%83%AD%E3%82%B0%E8%87%AA%E4%BD%93%E3%82%92%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B%E3%82%B3%E3%82%B9%E3%83%88\" aria-label=\"ブログ自体を作成するコスト permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>ブログ自体を作成するコスト</h3>\n<p>もともと使い慣れているMiddlemanを使用すれば大した手間もハマりもなく行けるであろうと予想<br>\nほかにもJekyllやGatsbyなどの静的サイトジェネレータも調べてみましたが、結局慣れてるMiddlemanにしました</p>\n<h3 id=\"記事を作成するコスト\" style=\"position:relative;\"><a href=\"#%E8%A8%98%E4%BA%8B%E3%82%92%E4%BD%9C%E6%88%90%E3%81%99%E3%82%8B%E3%82%B3%E3%82%B9%E3%83%88\" aria-label=\"記事を作成するコスト permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>記事を作成するコスト</h3>\n<p>素のMarkdownを使い慣れたテキストエディタで書けるので全く問題なし。<br>\nメタ情報もfrontmatterに突っ込めばいいだけなので問題なし。ただ、タグのサジェストがないとタグ名が表記揺れしそうで若干怖い</p>\n<h3 id=\"予約投稿cron相当が失われる\" style=\"position:relative;\"><a href=\"#%E4%BA%88%E7%B4%84%E6%8A%95%E7%A8%BFcron%E7%9B%B8%E5%BD%93%E3%81%8C%E5%A4%B1%E3%82%8F%E3%82%8C%E3%82%8B\" aria-label=\"予約投稿cron相当が失われる permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>予約投稿（cron相当）が失われる？</h3>\n<p>Netlifyには特定のURLからビルドをトリガーしたり、APIが提供されていたりするので、<br>\nそれをHeroku schedulerやTravisのcronで叩けば回避できる</p>\n<p>Travisは最小で1回/1dしかビルドできない、Heroku schedulerなら1回/1hでビルドできるので、予約投稿に十分な細かさを持っていると判断</p>\n<h3 id=\"サイト内検索を実装するコスト\" style=\"position:relative;\"><a href=\"#%E3%82%B5%E3%82%A4%E3%83%88%E5%86%85%E6%A4%9C%E7%B4%A2%E3%82%92%E5%AE%9F%E8%A3%85%E3%81%99%E3%82%8B%E3%82%B3%E3%82%B9%E3%83%88\" aria-label=\"サイト内検索を実装するコスト permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>サイト内検索を実装するコスト</h3>\n<p>記事データをJSON化して、<a href=\"https://lunrjs.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lunr.js</a>か<a href=\"http://elasticlunr.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Elasticlunr.js</a>を使って自前で実装するか、<br>\nReact nativeやMiddlemanの公式サイトでも使われる<a href=\"https://www.algolia.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Algolia</a>や<a href=\"https://community.algolia.com/docsearch/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">DocSearch</a>など、回避手段は色々ありそうなので、然程コストかけずに対応できそう。</p>\n<h3 id=\"今まで使っていたwordpressのプラグイン相当の機能の実現\" style=\"position:relative;\"><a href=\"#%E4%BB%8A%E3%81%BE%E3%81%A7%E4%BD%BF%E3%81%A3%E3%81%A6%E3%81%84%E3%81%9Fwordpress%E3%81%AE%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E7%9B%B8%E5%BD%93%E3%81%AE%E6%A9%9F%E8%83%BD%E3%81%AE%E5%AE%9F%E7%8F%BE\" aria-label=\"今まで使っていたwordpressのプラグイン相当の機能の実現 permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>今まで使っていたWordpressのプラグイン相当の機能の実現</h3>\n<p>取捨選択した上でMiddlemanのプラグインで代替手段を探した。<br>\nクリティカルなのはクリティカルなのは静的なシンタックスハイライトでしたが、それもプラグイン見つけてうまく馴染んだので問題なかった</p>\n<h2 id=\"gatsby-vs-jekyll-vs-middleman\" style=\"position:relative;\"><a href=\"#gatsby-vs-jekyll-vs-middleman\" aria-label=\"gatsby vs jekyll vs middleman permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Gatsby vs Jekyll vs Middleman</h2>\n<p>静的サイトジェネレータの選定のメモを残しておきます</p>\n<table>\n<thead>\n<tr>\n<th>#</th>\n<th>Middleman</th>\n<th>Jekyll</th>\n<th>Gatsby</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>言語</td>\n<td>Ruby</td>\n<td>Ruby</td>\n<td>Node</td>\n</tr>\n<tr>\n<td>慣れ</td>\n<td>○</td>\n<td>△</td>\n<td>×</td>\n</tr>\n<tr>\n<td>ツールとしての好み</td>\n<td>○</td>\n<td>△</td>\n<td>×</td>\n</tr>\n<tr>\n<td>カスタマイズ性</td>\n<td>○</td>\n<td>○</td>\n<td>△</td>\n</tr>\n<tr>\n<td>プラグインの豊富さ</td>\n<td>○</td>\n<td>○</td>\n<td>△</td>\n</tr>\n<tr>\n<td>情報量</td>\n<td>△</td>\n<td>○</td>\n<td>×</td>\n</tr>\n</tbody>\n</table>\n<p>個人的にはこんな感じでした。<br>\nGatsbyというReactのSSRを利用した静的サイトジェネレータ、コンセプトやコードはかなり面白くて最初はこれを採用しようと思ったのですが、</p>\n<ul>\n<li>ページネーションを自前で実装する必要がある</li>\n<li>v1への過渡期でドキュメント及び情報がほぼゼロ。ソースを読んで理解を進めて行くほどの時間は取れない。時期尚早すぎる</li>\n<li>v1に移行されたとしてもMarkdownパーサ周りがいまいち（remarkのプラグインが素では使えずGatsby用にラップしないとダメ）</li>\n<li>v1からはGraphQL使用する前提、まだ枯れてないミドルウェアに密に結合したツールは怖い</li>\n<li>静的にレンダリングされるHTMLと動的にフロントで動くjsの区別がつきにくい</li>\n</ul>\n<p>などの問題があり、使い慣れているMiddlemanを採用しました。<br>\nただ、MiddlemanもRailsの変化からかv4から大きく仕様やコードの構造が変わっており、数年前に使ったことあるだけの知識では結局どハマりしました。</p>\n<p>その辺の過程はまた別の記事に書き留めていきます。</p>\n<h2 id=\"heroku-vs-github-pages-vs-s3-vs-netlify\" style=\"position:relative;\"><a href=\"#heroku-vs-github-pages-vs-s3-vs-netlify\" aria-label=\"heroku vs github pages vs s3 vs netlify permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Heroku vs Github pages vs S3 vs Netlify</h2>\n<ul>\n<li>問題が起きない限りは24h365d稼働している想定</li>\n<li>ブログのソースはGithubにpublicで公開（オープンソースのボーナス狙い）</li>\n<li>独自に取得したサブドメインを指定する</li>\n<li>サブドメのDNSは移譲していいが、権威DNSはさくらから移行しない</li>\n</ul>\n<table>\n<thead>\n<tr>\n<th>#</th>\n<th>Heroku+nginx</th>\n<th>Github pages</th>\n<th>AWS S3+CloudFront+Route53+ACM</th>\n<th>Netlify</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>HTTPS</td>\n<td>✔︎</td>\n<td>✔︎</td>\n<td>✔</td>\n<td></td>\n</tr>\n<tr>\n<td>HTTP/2</td>\n<td>✔</td>\n<td>✔</td>\n<td>✔</td>\n<td></td>\n</tr>\n<tr>\n<td>料金</td>\n<td>$7/月</td>\n<td>0</td>\n<td>従量制</td>\n<td>0</td>\n</tr>\n<tr>\n<td>慣れ</td>\n<td>○</td>\n<td>△</td>\n<td>×</td>\n<td>×</td>\n</tr>\n<tr>\n<td>設定の簡単・確実さ</td>\n<td>○</td>\n<td>○</td>\n<td>×</td>\n<td>○</td>\n</tr>\n<tr>\n<td>Webサーバの設定の柔軟さ</td>\n<td>△</td>\n<td>×</td>\n<td>○</td>\n<td>○</td>\n</tr>\n<tr>\n<td>情報量</td>\n<td>△</td>\n<td>○</td>\n<td>○</td>\n<td>×</td>\n</tr>\n</tbody>\n</table>\n<p>という感じで、結果Netlifyに挑戦することにしました。　　</p>\n<p>AWSのACMの署名がメールでしか行えず、権威DNSをRoute53に移譲すればSESで受信するという選択肢があるそうなのですが、<br>\nサブドメインだけ移譲するパターンでうまく受信ができず、諦めました。</p>\n<p>Google Cloud Storageも頭によぎったが、結論としてS3を選外にしたので割愛します</p>\n<p>設定がAWS慣れてない私には難しく、かつACM（のドメイン署名）が突破できないので諦めました…。<br>\n権威DNSをRoute53に移行しないとSESでメール受信すらできないので、署名不可能</p>\n<h2 id=\"wpで書いた記事を全てエクスポートする\" style=\"position:relative;\"><a href=\"#wp%E3%81%A7%E6%9B%B8%E3%81%84%E3%81%9F%E8%A8%98%E4%BA%8B%E3%82%92%E5%85%A8%E3%81%A6%E3%82%A8%E3%82%AF%E3%82%B9%E3%83%9D%E3%83%BC%E3%83%88%E3%81%99%E3%82%8B\" aria-label=\"wpで書いた記事を全てエクスポートする permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>WPで書いた記事を全てエクスポートする</h2>\n<p><a href=\"https://ja.wordpress.org/plugins/jekyll-exporter/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jekyll Exporter</a>というプラグインを利用し、全ての記事をFrontmatter付きMarkdownに変換しました。<br>\n新旧さまざまな書き方が混在しており、それらの統一もしたことなかったので、もちろんエクスポートしたままでうまく行くわけもなく、正規表現でゴリゴリと一括置換かけていきました。</p>\n<h2 id=\"bootstrap4を入れる\" style=\"position:relative;\"><a href=\"#bootstrap4%E3%82%92%E5%85%A5%E3%82%8C%E3%82%8B\" aria-label=\"bootstrap4を入れる permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Bootstrap4を入れる</h2>\n<p>Sassを使い、必要なパーツだけを部分的に<code>@import</code>して行くようにしました。<br>\nブログリニューアル時点で使ったのは、これらのファイルです。</p>\n<div class=\"gatsby-highlight\" data-language=\"scss\"><pre class=\"language-scss\"><code class=\"language-scss\"><span class=\"token keyword\">@import</span> <span class=\"token string\">\"./variables\"</span><span class=\"token punctuation\">;</span> <span class=\"token comment\">// ここでBootstrapの変数を拡張する</span>\n\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap-grid\"</span><span class=\"token punctuation\">;</span>              <span class=\"token comment\">// 全部入りより最小限入ったもの</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/variables\"</span><span class=\"token punctuation\">;</span>         <span class=\"token comment\">// Bootstrap内で使用する設定値の読み込み。上書きしたければここに変数が書かれている</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/mixins\"</span><span class=\"token punctuation\">;</span>            <span class=\"token comment\">// Bootstrap内で使用するMixinの読み込み</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/custom\"</span><span class=\"token punctuation\">;</span>            <span class=\"token comment\">// なんか要る</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/utilities/flex\"</span><span class=\"token punctuation\">;</span>    <span class=\"token comment\">// FlexBox系のユーティリティを使用するなら必要</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/utilities/spacing\"</span><span class=\"token punctuation\">;</span> <span class=\"token comment\">// 余白系のユーティリティを使用するなら必要</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/buttons\"</span><span class=\"token punctuation\">;</span>           <span class=\"token comment\">// ボタン</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/forms\"</span><span class=\"token punctuation\">;</span>             <span class=\"token comment\">// フォーム。navbarで使用</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/nav\"</span><span class=\"token punctuation\">;</span>               <span class=\"token comment\">// navbarのために必要</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/navbar\"</span><span class=\"token punctuation\">;</span>            <span class=\"token comment\">// ページ上部に使用</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/breadcrumb\"</span><span class=\"token punctuation\">;</span>        <span class=\"token comment\">// パンくず。メインコンテンツの手前に配置</span>\n<span class=\"token keyword\">@import</span> <span class=\"token string\">\"bootstrap/input-group\"</span><span class=\"token punctuation\">;</span>       <span class=\"token comment\">// inputの隣にアイコン置いたりするなら必要</span></code></pre></div>\n<h2 id=\"今まで使っていたwordpressのプラグイン相当の機能の実現-1\" style=\"position:relative;\"><a href=\"#%E4%BB%8A%E3%81%BE%E3%81%A7%E4%BD%BF%E3%81%A3%E3%81%A6%E3%81%84%E3%81%9Fwordpress%E3%81%AE%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E7%9B%B8%E5%BD%93%E3%81%AE%E6%A9%9F%E8%83%BD%E3%81%AE%E5%AE%9F%E7%8F%BE-1\" aria-label=\"今まで使っていたwordpressのプラグイン相当の機能の実現 1 permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>今まで使っていたWordpressのプラグイン相当の機能の実現</h2>\n<h3 id=\"google-xml-sitemap\" style=\"position:relative;\"><a href=\"#google-xml-sitemap\" aria-label=\"google xml sitemap permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><a href=\"https://ja.wordpress.org/plugins/google-sitemap-generator/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google XML Sitemap</a></h3>\n<p><a href=\"https://github.com/Aupajo/middleman-search_engine_sitemap\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Aupajo/middleman-search_engine_sitemap</a>を使えば良さそう。問題なし</p>\n<h3 id=\"wp-social-bookmarking-light\" style=\"position:relative;\"><a href=\"#wp-social-bookmarking-light\" aria-label=\"wp social bookmarking light permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><a href=\"https://ja.wordpress.org/plugins/wp-social-bookmarking-light/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">WP Social Bookmarking Light</a></h3>\n<p>それぞれHTMLパーツ持って来ればいいだけなので特に問題なし</p>\n<h3 id=\"comet-cache\" style=\"position:relative;\"><a href=\"#comet-cache\" aria-label=\"comet cache permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><a href=\"https://wordpress.org/plugins/comet-cache/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Comet Cache</a></h3>\n<p>静的ファイルなのでクエリ時間はもともと削減されている。<br>\n静的ファイルについてはNetlifyがよしなに配信してくれるので、あまり気にしなくても基本いい感じにキャッシュが効いてくれる</p>\n<h3 id=\"crayon-syntax-highlighter\" style=\"position:relative;\"><a href=\"#crayon-syntax-highlighter\" aria-label=\"crayon syntax highlighter permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><a href=\"https://wordpress.org/plugins/crayon-syntax-highlighter/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Crayon Syntax Highlighter</a></h3>\n<p>Rubyの<a href=\"https://github.com/jneen/rouge\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Rouge</a>を使って、HTML作成時にハイライト済みのHTMLにして描画時のパフォーマンスを上げる作戦<br>\nむしろ上位互換なので問題なし</p>\n<h2 id=\"あとがき\" style=\"position:relative;\"><a href=\"#%E3%81%82%E3%81%A8%E3%81%8C%E3%81%8D\" aria-label=\"あとがき permalink\" class=\"autolink-header before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>あとがき</h2>\n<p>雑記的な感じになっておりますが、最低限公開できるだけのリニューアルは終わったかなと思います。<br>\nまだまだ治したいところ、追加したい機能、最適化したいアセットなどがモリモリですが、焦らずしっくりと進めていきます。</p>\n<p>もしこのブログ（記事の内容も含めて）に何か問題があれば、リポジトリのIssueを立てていただければと思います。<br>\nまた、書こうとしている記事のネタもIssueで管理しているので、暇つぶしがてらチラッと眺めてみていただけると幸いです。</p>\n<p>これからもWeb EGGをよろしくおねがいいたします。</p>","timeToRead":12,"frontmatter":{"title":"Wordpressで運用していたブログをMiddleman+Netlifyに変更した","tags":["Wordpress","AWS","Middleman","Netlify"],"date":"July 04, 2017","featuredImage":{"childImageSharp":{"fluid":{"tracedSVG":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='400'%20height='120'%20viewBox='0%200%20400%20120'%20preserveAspectRatio='none'%3e%3cpath%20d='M4%2014c2%204%204%205%205%202v-2l1%202c1%203%203%202%205-2l1-3v3c0%204%200%204%204%204%203%200%204-2%201-2-2%200-2%200-1-1%203%200%203-2%200-2-1-1-1-1%201-1%204%200%202-2-3-2-4%200-5%200-5%202l-1%203v-3c-1-3-4-3-4%200l-1%202-1-2-1-2c-2%200-2%201-1%204M3%2074v34h296V40H3v34m77-14l2%201%201%201-1%201c-1%200-2%201-2%203s0%202%206%202c4%200%206%200%206-2h2l1%201c-1%201%202%202%204%201l1-5v-4h-9v4l-1%204-1-4v-4h-5l-4%201m230%2018c0%204%200%205%202%206h4l1-1-1-1v-3c0-4%200-4%203-3%204%200%205%201%203%202l-1%204-2%202v1c1%200%202%201%201%202l1%202%201%201c-1%201%200%201%201%201l2%201h-6c-4%200-5%200-4%201s1%201-1%201c-1%200-2%200-1-1l-1-1-2%203c0%202%200%202%2012%202h13l-1-5a2627%202627%200%20010-12c1-3-1-5-5-5l-2-1-9-1h-8v5'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e","aspectRatio":3.34,"src":"/static/92b84a323834c47bf34bd56285ad0f95/8eab8/featured-image.png","srcSet":"/static/92b84a323834c47bf34bd56285ad0f95/1ec58/featured-image.png 334w,\n/static/92b84a323834c47bf34bd56285ad0f95/ccb4a/featured-image.png 668w,\n/static/92b84a323834c47bf34bd56285ad0f95/8eab8/featured-image.png 1336w,\n/static/92b84a323834c47bf34bd56285ad0f95/85e22/featured-image.png 2004w,\n/static/92b84a323834c47bf34bd56285ad0f95/2fba6/featured-image.png 2138w","srcWebp":"/static/92b84a323834c47bf34bd56285ad0f95/f7e47/featured-image.webp","srcSetWebp":"/static/92b84a323834c47bf34bd56285ad0f95/cd98f/featured-image.webp 334w,\n/static/92b84a323834c47bf34bd56285ad0f95/7535d/featured-image.webp 668w,\n/static/92b84a323834c47bf34bd56285ad0f95/f7e47/featured-image.webp 1336w,\n/static/92b84a323834c47bf34bd56285ad0f95/f6b67/featured-image.webp 2004w,\n/static/92b84a323834c47bf34bd56285ad0f95/ebf08/featured-image.webp 2138w","sizes":"(max-width: 1336px) 100vw, 1336px"}}}}}},"pageContext":{"slug":"/migrate-wp-to-middleman-and-netlify/","previous":{"fields":{"slug":"/es2017-arrow-func-syntax/"},"frontmatter":{"title":"条件付きな構文が多い昨今のNode.jsのアロー関数の構文をまとめてみた","tags":["JavaScript","Nodejs"]}},"next":{"fields":{"slug":"/automate-build-netlify-with-heroku/"},"frontmatter":{"title":"NetlifyとHerokuで予約投稿機能を実現する","tags":["Netlify","Heroku"]}}}},
    "staticQueryHashes": ["2585454260","2954598359"]}