博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
搭建自己的hexo博客
阅读量:7072 次
发布时间:2019-06-28

本文共 2284 字,大约阅读时间需要 7 分钟。

这是我最近用hexo搭建的个人博客,欢迎来参观留言,以下是我创建这个hexo的一步步步骤,欢迎指正!

  

  参考自 ;

  主题参考这里 ;

  主题选自这里 ;

  

1. 安装node;

2. 安装git;

3. 注册github账号;

4. 新建文件夹'blog',进入blog,打开命令窗口。

  4.1. npm install hexo -g;

  4.2. npm init; (MIT协议);

  4.3. hexo init; //初始化

  4.4. hexo generate //配置静态文件;

  4.5. hexo server //启动服务 http://localhost:4000;

5. 连接github.io

  5.1. 建立repository: 仓库名为【username.github.io】,固定写法;

  5.2. 修改_config.yml文件 【repo也可以SSH协议】

deploy:         type: git         repo: git@github.com:winterZhao/winterZhao.github.io.git         branch: master

  5.3. npm install hexo-deployer-git --save

  5.4. hexo deploy //另一种推送到github上的形式,这时候访问winterZhao.github.io就可以了

6. 主题

,后头写有demo的为展示效果

我选择的是Hexadillax

  6.1. 在blog目录下 git clone git@github.com:XadillaX/hexadillax.git将github上的文件copy到本地;

  6.2. 将_config.sample.yml里的内容复制到根目录_config.yml里;修改github,我的为winterZhao/winterZhao.github.io;

  6.3. 在source文件夹下新建文件夹tags,在其内新建index.md,写入内容:

layout: tagstitle: tags---

  6.4. 在source文件夹下新建文件夹categories,在其内新建index.md,写入内容:

layout: categoriestitle: categories---

     : 默认没有采用/tags/categories页面(标签和分类,需要的话执行6.3/6.4两步);

  6.5. 将下载的Hexadillax文件夹整体复制到themes下;

  6.6. 修改_config.yml里的themehexadillax;

  6.7. 替换source/images下的avatar头像和background,名字不要改;

  6.8. 替换icon图,在网站根目录以及themes/hexadillax/source下存放在网上生成的favicon.ico;

7.添加百度统计

`_config.yml` 配置文件里添加`baidu_analytics:  id`;

8. 上传到github上,覆盖之前的;

  8.1. npm install hexo-deployer-git --save;

  8.2. hexo deploy;

  : 每次本地修改以后都要重复执行这两条命令;如果执行后没有效果,则按照git的流程进行

git add -A;git commit -m "提交";git pullgit push -u origin master

9. 安装爬虫插件;

  9.1. npm isntall hexo-generator-sitemap;

     npm isntall hexo-generator-feed;

  9.2. 修改_config.yml,增加内容:

# ExtensionsPlugins:- hexo-generator-feed- hexo-generator-sitemap#Feed Atomfeed:  type: atom  path: atom.xml  limit: 20#sitemapsitemap:  path: sitemap.xml

10. 增加评论功能;

  10.1. 注册多说账号;

  
  10.2. 在_config.yml里的duoshuo写上自己注册的多说账号;

11. 写文章;

  11.1. 命令窗口 hexo clean; //删除生成的文件和缓存public文件夹

  11.2. 命令窗口 hexo new 文章名;

  11.3. 在source/_posts下找到对应的md文档,写markdown文章;

  11.4. 命令窗口 hexo generate; //生成静态文件public

  11.5. 命令窗口 hexo deploy; //推送到github上

  11.6. 删除或编辑文章,修改或删除source/_post里对于的markdown文章,重新执行hexo generate=>hexo deploy;

:当我们hexo deploy的时候,会只将public文件推送到github上,这是hexo默认的,不影响结构。

转载于:https://www.cnblogs.com/zhaowinter/p/5409274.html

你可能感兴趣的文章
android图片处理
查看>>
CentOS7中firewall防火墙详解和配置,.xml服务配置详解
查看>>
电子表格控件Spreadsheet 对象方法事件详细介绍
查看>>
自动填写短信验证码
查看>>
linux CentOS7最小化安装环境静默安装Oracle11GR2数据库(安装依赖包)
查看>>
运维自动化工具Cobbler之—标准化
查看>>
编译linux-3.15.5时遇到的几个错误
查看>>
nginx启动,重启,关闭命令
查看>>
redhat5.8+pam+mysql+vsftp(提供软件包可以到 百度云盘下载 账号 pankuo1@sina.cn 密码pk492940446)...
查看>>
支持Flash转换可打印的PDF文件的PDF转换控件ActivePDF WebGrabber
查看>>
JavaScript的一些概念: typeof, null, 和 undefined
查看>>
服务器网卡丢包
查看>>
bzoj 2245: [SDOI2011]工作安排
查看>>
在LINUX下面建立GPRS无线MODEM拨号
查看>>
Photoshop制作一个质感的卡通小公仔
查看>>
VS2010编译错误之mt.exe : general error c101008d
查看>>
Vue CLI 3开发中屏蔽烦人的EsLint错误
查看>>
Percona XtraDB Cluster 集群环境建立与验证指南
查看>>
沣西大数据产业模式初探
查看>>
戴尔:给企业客户松绑
查看>>