使用Hexo搭建网站个人总结

  1. 使用Hexo搭建网站个人总结

使用Hexo搭建网站个人总结

1.安装环境

  • Git
  • Node.js
    (因平时开发环境用这两个环境,安装过程省略)

2.安装Hexo

$:npm install -g hexo-cli

3.创建Web项目
创建一个空的文件夹MyWeb,右键打开Git Bash Here(成功安装Git后,右键菜单有这个选项)

$ hexo init MyWeb
$ cd MyWeb
$ npm install

执行后目录如下:

.
├── _config.yml
├── package.json
├── scaffolds
├── source
|   ├── _drafts
|   └── _posts
└── themes

安装其他依赖(根据需要)

$ npm install hexo-wordcount --save
$ npm install hexo-generator-archive --save
$ npm install hexo-generator-category --save
$ npm install hexo-generator-feed --save
$ npm install hexo-generator-index --save
$ npm install hexo-generator-json-content --save
$ npm install hexo-generator-search --save
$ npm install hexo-generator-sitemap --save
$ npm install hexo-generator-tag --save
$ npm install hexo-generator-topindex --save
$ npm install hexo-renderer-ejs --save
$ npm install hexo-renderer-marked --save
$ npm install hexo-renderer-stylus --save
$ npm install hexo-server --save
$ npm install hexo-wordcount --save

4.复制主题

以我使用的3-Hexo为例

git clone https://github.com/yelog/hexo-theme-3-hexo.git themes/3-hexo

5.配置主题

修改MyWeb根目录下文件_config.yml,如下

theme: 3-hexo

3-hexo主题详细配置参考

6.创建页面

hexo new page --path other/0001_hexo_guide

编写内容参考Markdown语法

7.生成预览

$hexo clean && hexo g && hexo s

打开http://localhost:4000可预览效果

8.发布到Git
使用Github创建项目,因很久以前就创建过,过程略,我的地址

修改MyWeb根目录下文件_config.yml,如下

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type: git
  repo: https://github.com/max-xue/max-xue.github.io
  branch: master
  message: "Site updateed: {{ now('YYYY-MM-DD HH:mm:ss') }}"

执行

$hexo clean && hexo g && hexo d

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 xue_huashan@163.com

文章标题:使用Hexo搭建网站个人总结

文章字数:388

本文作者:max-xue

发布时间:2019-10-11, 11:58:48

最后更新:2019-11-08, 21:45:32

原始链接:http://blog.le-more.com/2019/10/11/top/0001_hexo_guide/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏