LoginSignup
1
0

More than 1 year has passed since last update.

Hexoでブログを作る

Last updated at Posted at 2022-02-01

TEMPLATE BLOG

直接使えるtemplateもgithub上で用意しています。
ご参考になればと思います。

CODE
BLOG URL

自分のrepoを使う時に、変更する必要のある場所は
1. Deploy Setting
2. Github Pages Setting
3. Set Github Page URL

Hexo とは

  1. Node.js製の静的サイトジェネレータ
  2. markdown形式で書いた記事は、最終的にはHTML形式に出力される

node.js

Node.js製の静的サイトジェネレータなので、 Node.jsをインストールする必要がある

nvm

nvmNode.jsをインストールする

Install

npm install -g hexo-cli

Commands

$ hexo init [folder]
$ hexo server

Deploy to Github

hexo-deployer-gitをインストール

$ npm install hexo-deployer-git --save

Deploy Setting

_config.yamlのdeploy設定を設置

branchを pages に設置

_config.yaml
deploy:
  type: git
  repo: <repository ssh> # git@github.com:<user>/<repository name>.git
  branch: pages

Deploy Command

hexo clean && hexo deploy

Github Pages Setting

Branchはpagesを選択

Folderはrootを選択

截圖 2022-02-02 15.04.28.png

Set Github Page URL

_config.yaml
# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://username.github.io/project

Github Actions

main branchをpushするたびに、自動的にpage branchにdeployする

.github/workflows/pages.ymlを追加

deploying branchpagesを設置

.github/workflows/pages.yml
publish_branch: pages # deploying branch

1
0
0

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
1
0