搭建hexo+next博客并把项目主页放在上面
其实博客还是想用csdn写,但是像jupyter notebook这些,想在网上贴出来,一方面和大家分享,一方面也想留作存档,在csdn就不太方便,还是githube page好。之前在github page上搭了博客,随后由于懒惰废弃了,想从新捡起,可当时安装了很多依赖,现在找不回来,导致hexo已经生成不了,因为之前用的不多,所以索性重新再来,也一边在这里记录,免得下次又忘。
这次还是选择hexo,一方面好看,另外也方便,配置好了后直接hexo d就可以同步到page上。
那么开始。
怎么在github pages上搭主页可以参考GitHub-Pages-Hexo-NexT-快速构建静态Blog。
找好看的主题
首先要找个好的hexo主题,要明确我不是想用来做博客,而是分享一些项目,所以要求主页清晰明了。
找了一圈,没有特别满意的, 还是用next吧
主要步骤
- 装npm
- 装hexo
- 初始化hexo
 命令行输入hexo init pagepage是想初始化的文件夹名
- next主题
 https://github.com/theme-next/hexo-theme-next- 进入文件夹,克隆next库
 cd page
 git clone https://github.com/theme-next/hexo-theme-next themes/next
- 切换主题:在根目录里的_config.yml文件中,theme字段设为next
- 完工,看一看完成情况hexo s
 
- 进入文件夹,克隆next库
- 配置deploy 
 https://hexo.io/docs/deployment.html- 安装hexo-deployer-git
- 根目录里的 - _config.yml文件- 1 
 2
 3
 4
 5- deploy: 
 type: git
 repo: git@github.com:username/username.github.io.git
 branch: master
 message: "{{ now('YYYY-MM-DD HH:mm:ss') }}"
- hexo d部署
- 访问一下 jinnsjj.github.com
 
- 安装
一些配置
首先还是去_config.yml里,把最上面的title啊描述啊按自己的喜好改一改
资源文件夹
对于每个文章,生成一个文件夹存放里面的媒体文件。
根目录里的_config.yml文件
| 1 | post_asset_folder: true | 
网站内搜索
https://github.com/theme-next/hexo-generator-searchdb
npm install hexo-generator-searchdb --save
站点的配置文件中加入
| 1 | search: | 
注意field改为all,这样我们自己的project页面才能被搜索到。
leancloud阅读计数
https://leaferx.online/2018/02/11/lc-security/
add this 分享
https://theme-next.iissnan.com/third-party-services.html+https://github.com/iissnan/hexo-theme-next/issues/906
这一块可能会被chrome的ghost插件拦截,导致看不到效果。
放置项目的地方
在source文件夹里面建立一个projects文件夹,把jupyter notebook导出的html文件或者其他的html直接放在里面就好。再在根目录的_config.yml中间的skip_render项中加入projects/**,这样这个文件夹里的html就会直接显示了。**指跳过所有文件与文件夹 *指跳过所有文件。
无关紧要但好玩的东西
主页上的黑猫:
https://huaji8.top/post/live2d-plugin-2.0/
https://github.com/EYHN/hexo-helper-live2d/blob/master/README.zh-CN.md
首先安装模块npm install --save hexo-helper-live2d
_config.yml中加入1
2
3
4
5
6
7
8
9
10
11
12
13
14live2d:
  enable: true
  scriptFrom: local
  pluginRootPath: live2dw/
  pluginJsPath: lib/
  pluginModelPath: assets/
  model:
    use: live2d-widget-model-hijiki
  display:
    position: right
    width: 150
    height: 300
  mobile:
    show: true
model下use的模型需要安装npm install live2d-widget-model-hijiki
备注
npm命令的–save是将安装的依赖包写入目录里的package.json文件中
 
        