github为每个账户提供了一个免费的二级域名{username}.github.io,只需要在仓库{username}.github.io.git中编写代码就能自动实现网页的解析。使用Hexo能通过markdown文件实现博客内容的编写与发布,下面是Ubuntu1904下Hexo的搭建过程,其他环境同理。
环境安装
sudo apt update -y
sudo apt-get --purge remove nodejs curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - sudo apt-get install nodejs sudo apt install -y ruby python python-pip pip install npm
sudo npm install npm@latest -g sudo npm install -g cnpm --registry=https://registry.npm.taobao.org sudo cnpm install -g hexo-cli mkdir blog cd blog
sudo hexo init
cnpm install --save hexo-deployer-git
vim _config.yml
git clone http://github.com/litten/hexo-theme-yilia.git themes/yilia git clone https://github.com/Molunerfinn/hexo-theme-melody.git themes/melody cnpm install hexo-renderer-pug hexo-renderer-stylus cnpm install https://github.com/CodeFalling/hexo-asset-image --save mkdir theme/yilia/source/img
hexo clean
hexo g
hexo s
sudo hexo d
|
deploy: type: git repo: git@github.com:tiankx1003/tiankx1003.github.io.git branch: master
theme: yilia
avatar: /img/header.jpg
|