新しいコメントシステムを採用した
1
2
3
| $ cd ~/octopress/source
$ bower install m2w/talaria
$ bower install async
|
_includes/head.html
1
2
3
4
| <!-- talaria -->
<link href="{{ site.url }}/bower_components/talaria/dist/talaria.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="{{ site.url }}/bower_components/bluebird/js/browser/bluebird.js"></script>
<script type="text/javascript" src="{{ site.url }}/bower_components/talaria/dist/talaria.js"></script>
|
基本的に、コメントを表示したい場所に以下を入れれば表示されます。
1
2
3
4
| <script type="text/javascript">
talaria.init({REPOSITORY_NAME: 'syui.github.io',
GITHUB_USERNAME: 'syui'});
</script>
|
前提として、article
の中にa class="permalink"
が必要で、かつhref
はリポジトリのファイル名と同じものが必要になります。
_includes/article.html
1
2
3
4
5
6
7
8
9
10
11
12
13
| {% if index %}
<h1 class="entry-title"><a href="{{ post.url }}" class="permalink">{% if site.titlecase %}{{ post.title | titlecase }}{% else %}{{ post.title }}{% endif %}</a></h1>
{% else %}
<h1 class="entry-title"><a href="{{ page.url }}" class="permalink">
{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}
{% if page.subtitle %}
<small>
{% if site.titlecase %}{{ page.subtitle | titlecase }}{% else %}{{ page.subtitle }}{% endif %}
</small>
{% endif %}
</h1>
{% endif %}
|
リポジトリとの整合性については、通常、直接、talaria
のスクリプトを編集することで対応します。しかし、octopress
の場合は、masterブランチが_posts/foo.md
の形にならないので、その形式で追加pushするか、別のリポジトリに所定の形式でpushすることで対応できます。
個人的には、後者で対応しました。また、本ブログはプライベートリポジトリをwerckerでデプロイするため、ちょっと複雑です。
デプロイする際にコメント用のリポジトリを更新する必要があるからです。