我的第一篇文章
这是我的第一篇文章,主要记录一下hexo博客的建立和使用方法。
参考资料
搭建参考
主题配置
搭建过程
环境安装
- 需要安装git和Node.js
- 注册Github账号
安装Hexo
- 使用npm全局安装hexo
1
| sudo npm install -g sudo npm install -g hexo-cli
|
- 使用hexo init 初始化项目
1
| hexo init hexo init blog
|
- 使用hexo s查看状态(默认访问该地址http://localhost:4000 )
关联Github
- 创建仓库
- 开启Github Pages
- 选择分支
修改全局配置(注意:每个冒号后面都有个空格)
在项目中找到_config.yml文件,在文件最后添加如下内容:
1 2 3 4
| deploy: type: git repository: https://github.com/xxx/xxx.github.io.git branch: deploy: type: git repository: https://github.com/xxx/xxx.github.io.git branch: master
|
生成静态页面
- 执行生成静态文件命令
- 安装git上传插件
1
| npm install hexo-deployer-git npm install hexo-deployer-git --save
|
- 执行上传静态文件命令
常用命令
1 2 3 4 5
| hexo new "文章标题" hexo new page "页面名" hexo g hexo server hexo deploy |
主题使用
具体详细内容查看项目链接 hexo-theme-matery
文章头部示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| --- title: typora-vue-theme主题介绍 date: 2018-09-07 09:25:00 author: 赵奇 img: /source/images/xxx.jpg top: true
password: 8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92
mathjax: false categories: Markdown tags: - Typora - Markdown
--- title: typora-vue-theme主题介绍 date: 2018-09-07 09:25:00 author: 赵奇 img: /source/images/xxx.jpg top: true
password: 8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92
mathjax: false categories: Markdown tags: - Typora - Markdown ---
|
- 如果img属性不填写的话,文章特色图会根据文章标题的hashcode的值取余,然后选取主题中对应的特色图片,从而达到让所有文章都的特色图各有特色。
- date的值尽量保证每篇文章是唯一的,因为本主题中Gitalk和Gitment识别id是通过date的值来作为唯一标识的。
- 如果要对文章设置阅读验证密码的功能,不仅要在Front-matter中设置采用了SHA256加密的password的值,还需要在主题的_config.yml中激活了配置。有些在线的 SHA256 加密的地址,可供你使用:开源中国在线工具、chahuo、站长工具。