HEXO更换主题,比起Wordpress稍微麻烦一点点,但是过程更有编码的快感,下面,具体描述一下。
首先,HEXO的官方主题页是:https://hexo.io/themes/
点击图片,你可以看到某个主题的预览页
点击图片下的文字,你则能够找到某个主题在Github上的代码托管页
在Github上,找到对应主题的Git下载链接。
比如,我的环境中,这个链接是这样的:
https://github.com/wizardforcel/hexo-theme-landfarz.git
进入HEXO所在的服务器,并进入HEXO博客所在的数据目录
比如,在我的环境中,该路径是:
/hexo_web_data/adamhuan_blog/
则,我需要执行如下的方式:
1. 用GIT下载需要的主题源码,到HEXO博客的数据目录的theme目录下:
[root@center-linux ~]# cd /hexo_web_data/adamhuan_blog/ [root@center-linux adamhuan_blog]# ls _config.yml db.json node_modules package.json public scaffolds source themes [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# git clone https://github.com/wizardforcel/hexo-theme-landfarz.git themes/hexo-theme-landfarz Cloning into 'themes/hexo-theme-landfarz'... remote: Counting objects: 93, done. remote: Total 93 (delta 0), reused 0 (delta 0), pack-reused 93 Unpacking objects: 100% (93/93), done. [root@center-linux adamhuan_blog]#
2. 修改配置文件_config.yml
[root@center-linux adamhuan_blog]# pwd /hexo_web_data/adamhuan_blog [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# ls -ltr | grep --color config -rw-r--r--. 1 root root 1643 Jan 16 11:05 _config.yml [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# cat _config.yml | grep --color ^theme theme: hexo-theme-landfarz [root@center-linux adamhuan_blog]#
3. 然后,重启HEXO
[root@center-linux adamhuan_blog]# ps -ef | grep --color hexo root 30546 26282 0 11:00 pts/3 00:00:03 hexo root 31608 26282 0 11:14 pts/3 00:00:00 grep --color=auto --color hexo [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# netstat -tupln | grep --color hexo tcp 0 0 0.0.0.0:4000 0.0.0.0:* LISTEN 30546/hexo [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# kill -9 30546 [root@center-linux adamhuan_blog]# ps -ef | grep --color hexo root 31637 26282 0 11:14 pts/3 00:00:00 grep --color=auto --color hexo [1]+ Killed hexo server [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# netstat -tupln | grep --color hexo [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# hexo server & [1] 31657 [root@center-linux adamhuan_blog]# INFO Start processing [root@center-linux adamhuan_blog]# INFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop. [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# ps -ef | grep --color hexo root 31657 26282 22 11:15 pts/3 00:00:01 hexo root 31675 26282 0 11:15 pts/3 00:00:00 grep --color=auto --color hexo [root@center-linux adamhuan_blog]# [root@center-linux adamhuan_blog]# netstat -tupln | grep --color hexo tcp 0 0 0.0.0.0:4000 0.0.0.0:* LISTEN 31657/hexo [root@center-linux adamhuan_blog]#
4. 看看主题的样式的变化:
默认:landscape
刚刚更新的:
————————————————
Done。