美文网首页
搭建github博客

搭建github博客

作者: LOOK_LOOK | 来源:发表于2016-12-21 22:57 被阅读49次

原文地址

Whatever is worth doing is worth doing well.

曾经用过新浪博客,网速慢,用着不舒服,正好这几天有时间,下定决心利用github这个平台搭建自己的博客。第一篇不写自己,只把参考的文章分享一下以表敬意。

一、参考的文章

(1)以下任意一篇做下来都可以成功,辅助看可以加深理解,相辅相成。

(2)搭建好后就可以发博客了

(3)然后可以选择自己喜欢的主题换上


二、几个常用的命令

(1)关于主题

cd c

cd Hexo

git clone https://github.com/forsigner/fexo.git

  • 更换主题

手动更换:打开Hexo/_config.yml,找到theme,改为theme: fexo , 找到language: english,将zh-CN改为下载的主题下对应的zh-CNzh-Hans

  • 更新主题到博客

hexo clean

hexo generate

hexo deploy

(2)关于发博客

  • 生成新文章

hexo new "新的文章标题"

Hexo\source_posts文件下有新生成的新的文章标题.md,语法是markdown,简直不要太好用!用一次就上瘾了,语法简单,入门轻松!

  • 编辑好后就可以更新了,同上面的命令

hexo clean

hexo generate

hexo deploy

(3)更换电脑后如何更新博客

  • 将文件复制到本地
    根目录在E盘

git clone https://github.com/2016lkaust/2016lkaust.github.io.git

  • 进入文件夹

cd 2016lkaust.github.io

  • 安装hexo,不需要初始化了

npm install hexo
npm install
npm install hexo-deployer-git

此时就会出现一个新的文件夹Hexo
然后按照上面写博客的方式写就行了。

  • 提交修改可以用以下方法

git add <文件名>/*
git commit -m "信息"
git push origin Hexo

如下图:第一次出错了,写成了hexo。

Hexo是分支名

(4)关于markdown

  • 插入本地图片

首先确认 _config.yml 中有 <font color=red>post_asset_folder:true</font> 。

在 hexo 目录,执行
<table><td bgcolor="silver">

npm install https://github.com/CodeFalling/hexo-asset-image --save

</td></table>

假设在

我的第一篇博客(文件夹)

├── apppicker.jpg

├── logo.jpg

└── rules.jpg

我的第一篇博客.md

这样的目录结构(目录名和文章名一致),只要使用

![](我的第一篇博客/logo.jpg)

就可以插入图片。

  • 自定义字体颜色

<font color=red>这是效果颜色</font>

效果:<font color=red>这是效果颜色</font>

-自定义背景颜色

<table><td bgcolor=#F0F0F0>背景颜色是#F0F0F0</td></table>

效果:<table><td bgcolor=#F0F0F0>背景颜色是#F0F0F0</td></table>

就这样,博客搭建完毕,第一篇博文发表。从昨天中午到今天傍晚,终于稍稍入门了。以后将常驻这里了。

centos使用hexo
CentOS 7下手把手搭建hexo博客
安装
centos 使用 nvm 安装 nodejs
Centos Git1.7.1升级到Git2.2.1
centos 6.7 安装 最新版 git
-bash: hexo: command not found解决办法

[root@localhost hexo]# hexo
ERROR Script load failed: themes/next/scripts/tags/exturl.js
Error: Cannot find module 'hexo-util'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (/opt/blog/hexo/node_modules/hexo/lib/hexo/index.js:214:21)
    at /opt/blog/hexo/themes/next/scripts/tags/exturl.js:7:12
    at /opt/blog/hexo/node_modules/hexo/lib/hexo/index.js:230:12
    at tryCatcher (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:638:18)
    at Promise._resolveCallback (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:432:57)
    at Promise._settlePromiseFromHandler (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:524:17)
    at Promise._settlePromise (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/promise.js:638:18)
    at /opt/blog/hexo/node_modules/hexo/node_modules/bluebird/js/release/nodeback.js:42:21
    at /opt/blog/hexo/node_modules/hexo/node_modules/hexo-fs/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
Usage: hexo <command>

npm install hexo-util --save

? centos hexo d ERROR Deployer not found: git

npm install hexo-deployer-git --save

相关文章

网友评论

      本文标题:搭建github博客

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