Post ページを中心に改修した

/
#githubpages#jekyll

改修

内容

  • デザインの変更
    • dark theme
    • mobile first
      • Bootstrap の排除
  • Posts.index ページの追加
  • Post.show ページの追加
    • Syntax-highlighter Rouge の導入

デザイン変更

ページ表示速度 を向上させるため、メニュータブにしか使っていない Bootstrap 由来の JS と CSS を排除し、自作の js スクリプトを追加した。

undefined
1
<script>
2
'use strict';
3
{
4
const menuItems = document.querySelectorAll('.menu li a');
5
const contents = document.querySelectorAll('.content');
6
7
menuItems.forEach(clickedItem => {
8
clickedItem.addEventListener('click', e => {
9
e.preventDefault();
10
11
menuItems.forEach(item => {
12
item.classList.remove('active');
13
});
14
clickedItem.classList.add('active');
15
16
contents.forEach(content => {
17
content.classList.remove('active');
18
});
19
document.getElementById(clickedItem.dataset.id).classList.add('active');
20
});
21
});
22
}
23
</script>

Syntax-highlighter Rougeの導入

Posts.index と Post.show ページは jekyll 通りなので割愛。 コードのハイライトを有効化するため、Rouge を導入した。

undefined
1
gem 'rouge'
_config.yml
1
# this is defualt setting to use hightlight and endhighlight
2
markdown: kramdown
3
highlighter: rouge
4
5
# modify setting to use code block like Qiita
6
markdown: kramdown
7
kramdown:
8
input: GFM
9
hard_wrap: false
10
highlighter: rouge

あとは rougify style [<theme-name>] でシンタックスハイライト用の css、今回は molokai を生成し、一部修正、適用させた。

改修予定

  • AMP の導入。興味があるだけ