美文网首页个人博客搭建程序员
萌新折腾日记:github pages+hexo创建个人主页(1

萌新折腾日记:github pages+hexo创建个人主页(1

作者: JackyTsuuuy | 来源:发表于2016-03-31 01:47 被阅读229次

背景:

最近老想着折腾一个属于自己的博客。(虽然简书用起来方便,但是github逼格高啊!)所以出于种种原因吧,还是觉得github能比较个人特色鲜明点。而且在有些国内的博客都要翻墙访问的情况下,github的个人主页居然不需要,这种事也让我感受到了意外的惊喜。所以反正都是要翻墙折腾,不如就选一个有逼格的,当然装逼也是得付出点代价的,需要稍稍花点时间来折腾。

因为刚开始折腾,所以本篇先主要讲如何将这些基本部件安装搭起来。

此外,讲如何使用github pages和hexo搭建博客的教程很多。本教程部分也参考于这些。
这里也帮大家马一些:
(1)使用GitHub和Hexo搭建免费静态Blog
http://www.jianshu.com/p/465830080ea9
(2)Windows下一步步搭建自己的独立博客——使用 GitHub Pages + Hexo 基础教程
http://www.jianshu.com/p/985d07d88ef4
(3)一步步在GitHub上创建博客主页
http://www.pchou.info/web-build/2013/01/03/build-github-blog-page-01.html
(4)使用GitHub和Hexo搭建免费静态Blog
http://wsgzao.github.io/post/hexo-guide/

闲扯的有点多了,赶紧开始吧。因为自己是小白,我在这里主要是以小白视角讲一下如何理解并配置这些。

安装篇

总体来说,搭建这样一个博客,需要两个东西,就如题所讲,一是github,一是hexo。hexo是node.js下的一个静态博客框架。安装完node.js就会自带有hexo,再安装下即可使用。

(1)github windows桌面版:

https://desktop.github.com/
除了需要翻墙,基本是一键安装系列,不出意外安装完之后桌面上会多出来一个,github和一个git shell

(2)安装node.js:

https://nodejs.org
可能这里有两个版本,搭建hexo的话,貌似两个版本都可以,此处不需要纠结,也基本是一键安装

(3)安装hexo,这里可参考官网给出的方法:

https://hexo.io/zh-cn
其实官网给出的安装和使用方法还是挺详细的,比很多教程写的好,可以去看看

打开git shell,输入如下命令:
npm install hexo-cli -g //安装hexo hexo init blog //新建blog目录,初始化到blog目录下 cd blog //进入blog目录 npm install //安装

(4)安装hexo插件

执行下列命令即可安装以下插件,可以看作是安装generator,server,deploy这些命令下的一些功能吧
npm install hexo-generator-index --save npm install hexo-generator-archive --save npm install hexo-generator-category --save npm install hexo-generator-tag --save npm install hexo-server --save npm install hexo-deployer-git --save npm install hexo-deployer-heroku --save npm install hexo-deployer-rsync --save npm install hexo-deployer-openshift --save npm install hexo-renderer-marked@0.2 --save npm install hexo-renderer-stylus@0.2 --save npm install hexo-generator-feed@1 --save npm install hexo-generator-sitemap@1 --save

此时基本安装已经完成
执行以下命令,在浏览器登录localhost:4000即可查看效果
hexo server

基本的查看安装效果的方法:

cd进入安装的hexo目录(当然如果加入过环境变量应该就不用了)
hexo new 'title'//在source\_posts,生成文章,名为title hexo server //启动一个本地的服务器,在本地发布预览效果 hexo generator //生成public静态文件

相关文章

网友评论

    本文标题:萌新折腾日记:github pages+hexo创建个人主页(1

    本文链接:https://www.haomeiwen.com/subject/pgljlttx.html