Hexoのテーマ「matery」カスタマイズしたい!まずはじめにしたこと
このブログは、Hexoの materyでブログを書くために、カスタマイズしたところをまとめてみました。備忘録として書いています。
※ Hexoのダウンロードについて、参考にさせていただいたブログがこちら。
参考にさせていただいたHPはこちら >> 参考記事:GCP独自ドメインSSLブログが無料で使える(3)HEXO環境構築 daddytreviaさま
※ 今回、この記事では、hexoのテーマ(matery)のサイトより、コマンドなど一部、引用しています。
Hexoのテーマ「matery」ダウンロード
参考にさせていただいたHPはこちら >> 参考記事:リンク先
①カテゴリやタグを追加
「カテゴリ」「タグ」などを作成します。
hexo-theme-materyの通り、設定します。
以下のコマンドを順番にコピペし、コマンドを実行します。
hexo new page “categories”
hexo new page “tags”
hexo new page “about”
hexo new page “contact”
sourceの直下にフォルダが作成されます。
friendsも入れることができますが、私は入れていません。
そして追加したのが、
hexo new page “policy”
を追加しました。
②index.mdファイルの編集
さきほどのコマンドにて、ディレクトリのsourceの直下にできた、
- categories
- tags
- about
- contact
- policy
のフォルダの中にあるindex.mdの編集になります。
各フォルダの中にある index.md ファイルを開きます。
※ materyのページにある通り、それぞれコピペします。
※ dateの変更OK!
- categories
title: categories
date: 2018-09-30 17:25:30
type: “categories”
layout: “categories”
- tags
title: tags
date: 2018-09-10 18:23:38
type: “tags”
layout: “tags”
- about
title: about
date: 2018-09-30 17:25:30
type: “about”
layout: “about”
- contact
title: contact
date: 2018-09-30 17:25:30
type: “contact”
layout: “contact”
- policy
こちらの内容は、ネット検索にて「ポリシー コピペOK」で検索し、コピペしたものを張り付けています。
404のページを設定することもできます。
hexo-theme-materyの通り、設定すればOKです。
プラグインを追加した!
プラグインを順番に追加します。
config.ymlに追記します。
プラグイン:その①
npm i -S hexo-prism-plugin
コマンドを入力後に、hexo直下にあるconfig.ymlのところに追加する。
Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
enable: true # Open external links in new tab
field: site # Apply to the whole site
exclude: ‘’
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: false
prism_plugin:
mode: preprocess # realtime/preprocess
theme: 'tomorrow'
line_number: false # default false
custom_css:
プラグイン:その②
npm install hexo-generator-search --save
コマンドを入力後に、hexo直下にあるconfig.ymlのところに追加する。
Deployment
Docs: https://hexo.io/docs/deployment.html
deploy:
type: ‘’
search:
path: search.xml
field: post
プラグイン:その③
npm i hexo-permalink-pinyin --save
コマンドを入力後に、hexo直下にあるconfig.ymlのところに追加する。
URL
If your site is put in a subdirectory, set url as ‘http://yoursite.com/child‘ and root as ‘/child/‘
url: http://hatugokan.com
root: /
permalink: :title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing ‘index.html’ from permalinks
trailing_html: true # Set to false to remove trailing ‘.html’ from permalinkspermalink_pinyin:
enable: true
separator: '-' # default: '-'
他にもプラグインが公式サイトに記載されています。
まとめ
今回、「Hexoのテーマ「matery」まずはじめにしたこと」のお話をしました。
公式サイトの通り、設定すればできました。
半角スペースがないとエラーになったりするので、コピペする際は気をつけてください。
参考にさせていただいたHPはこちら >> リンク先
参考にさせていただいたHPはこちら >> 参考記事:daddytreviaさま
最後まで読んでいただき、ありがとうございました。
はつごかんでした。