LoginSignup
6

More than 5 years have passed since last update.

OctpressからHexoへのブログ移行手順

Last updated at Posted at 2015-03-16

概要

OctpressからHexoへブログシステムを移行した手順をまとめます。

1.Hexoの環境をつくる

以下の記事を参考にHexoの環境をつくる。

hexo deploy -gをするときにエラーが出てしまったのですが、以下のように設定し直すと解決しました。

_config.yml
# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
  type: git
  repo: github.ioのリポジトリ
  branch: hexo_posts

以下を実行。

# deployerがinstallされていなかった模様
$ npm install hexo-deployer-git --save

2.記事を移行する

markdown記事を移行します。

Octpressでのファイル名が、「2014-4-1-title.markdown」のようになっていたので、記事生成のフォーマットを以下のように変更しました。

_config.yml
# Writing
new_post_name: :year-:month-:day-:title.markdown # File name of new posts

また、既存記事のアクセスURLは変えないようにしたかったので、パーマリンクを以下のように変更しました。:idは、記事の中で指定します。

_config.yml
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://example.com
root: /
permalink: blog/:year/:month/:day/:id/
permalink_defaults:

記事内の変数は以下のように変更されました。増えたものは、id、categoryがtagsに、減ったものは、layoutとcommentsです。

2015-3-11-ここにタイトルを書く.markdown
title: "ここにタイトルを書く"
date: 2014-03-29 15:04:04 +0900
tags:
- "ブログに紐付けるタグ。"
- "複数指定する場合は"
- "このように書く。"
author: "自分の名前"
id: "URLの末尾となるので英語が好ましい"
---
以下にMarkdown形式でブログ内容を書いていく。

3.その他

a.Sitemap

こちらのプラグインで生成。

b.シェアボタン

こちらの変数を見ながらパーシャルを作成。

c.デザイン

デザインテーマを決める。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6