はじめに

こんにちは。インフラエンジニアレベル1の f_prg です。
Hexoの初期構築には右上にRSSフィードがあるですが、機能してませんでした。
プラグインでできるかなーとテキトーに考えて実装できたので、ご紹介します。

Hexoのプラグイン

ドキュメント

ドキュメントはコチラです。
https://github.com/hexojs/hexo/wiki/Plugins

アップデートする

インストールの前に、アップデートをします。

[18:30:48][f_prg@mba:blog]# npm update
npm http GET https://registry.npmjs.org/hexo-renderer-ejs/latest
npm http GET https://registry.npmjs.org/hexo-renderer-stylus/latest
npm http GET https://registry.npmjs.org/hexo-renderer-marked/latest
npm http 200 https://registry.npmjs.org/hexo-renderer-marked/latest
npm http GET https://registry.npmjs.org/hexo-renderer-marked
npm http 200 https://registry.npmjs.org/hexo-renderer-stylus/latest
npm http GET https://registry.npmjs.org/hexo-renderer-stylus
npm http 200 https://registry.npmjs.org/hexo-renderer-ejs/latest
npm http GET https://registry.npmjs.org/hexo-renderer-ejs
npm http 304 https://registry.npmjs.org/hexo-renderer-stylus
npm http GET https://registry.npmjs.org/nib/latest
npm http GET https://registry.npmjs.org/stylus/latest
npm http 304 https://registry.npmjs.org/hexo-renderer-marked
npm http GET https://registry.npmjs.org/marked/latest
npm http GET https://registry.npmjs.org/lodash/latest
npm http 200 https://registry.npmjs.org/nib/latest
npm http GET https://registry.npmjs.org/nib
npm http 200 https://registry.npmjs.org/stylus/latest
npm http GET https://registry.npmjs.org/stylus
npm http 200 https://registry.npmjs.org/marked/latest
npm http GET https://registry.npmjs.org/marked
npm http 200 https://registry.npmjs.org/lodash/latest
npm http GET https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/stylus
npm http 304 https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/hexo-renderer-ejs
npm http GET https://registry.npmjs.org/ejs/latest
npm http 200 https://registry.npmjs.org/ejs/latest
npm http GET https://registry.npmjs.org/ejs
npm http 304 https://registry.npmjs.org/ejs
npm http 304 https://registry.npmjs.org/nib
npm http 304 https://registry.npmjs.org/marked
npm http GET https://registry.npmjs.org/stylus/0.44.0
npm http GET https://registry.npmjs.org/stylus/0.37.0
npm http 200 https://registry.npmjs.org/stylus/0.37.0
npm http 200 https://registry.npmjs.org/stylus/0.44.0
npm http GET https://registry.npmjs.org/stylus/-/stylus-0.37.0.tgz
npm http GET https://registry.npmjs.org/stylus/-/stylus-0.44.0.tgz
npm http 200 https://registry.npmjs.org/stylus/-/stylus-0.37.0.tgz
npm http 200 https://registry.npmjs.org/stylus/-/stylus-0.44.0.tgz
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/sax
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/sax
npm http GET https://registry.npmjs.org/css-parse
npm http GET https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/css-parse
npm http 304 https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/ms/0.6.2
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/ms/0.6.2
npm http 304 https://registry.npmjs.org/inherits
stylus@0.37.0 node_modules/hexo-renderer-stylus/node_modules/nib/node_modules/stylus
├── mkdirp@0.3.5
├── cssom@0.2.5
├── debug@1.0.4 (ms@0.6.2)
└── sax@0.5.8
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/sigmund
stylus@0.44.0 node_modules/hexo-renderer-stylus/node_modules/stylus
├── css-parse@1.7.0
├── mkdirp@0.3.5
├── debug@1.0.4 (ms@0.6.2)
├── sax@0.5.8
└── glob@3.2.11 (inherits@2.0.1, minimatch@0.3.0)

プラグインの追加

RSSフィード用のプラグインをインストールします。

[21:08:10][f_prg@mba:blog]# npm install hexo-generator-feed
npm http GET https://registry.npmjs.org/hexo-generator-feed
npm http 200 https://registry.npmjs.org/hexo-generator-feed
npm http GET https://registry.npmjs.org/hexo-generator-feed/-/hexo-generator-feed-0.2.0.tgz
npm http 200 https://registry.npmjs.org/hexo-generator-feed/-/hexo-generator-feed-0.2.0.tgz
npm http GET https://registry.npmjs.org/utils-merge
npm http GET https://registry.npmjs.org/ejs
npm http 200 https://registry.npmjs.org/utils-merge
npm http 304 https://registry.npmjs.org/ejs
hexo-generator-feed@0.2.0 node_modules/hexo-generator-feed
├── utils-merge@1.0.0
└── ejs@1.0.0

簡単ですね。

フィードの設定完了

http://localhost:4000/atom.xml
でフィードができるようになりました。

まとめ

初期状態のサイト上にあるので、最初から入ってると嬉しいですね。

参考資料・リンク

https://github.com/hexojs/hexo/wiki/Plugins

元記事はこちらです。
HexoのRSSフィードプラグインを使ってみる