15分钟搭建独立电子书博客
效果图
从零到壹全栈部落电子书:http://fullstack.kongyixueyuan.com
说明
本电子书原模版采用的是阮一峰老师的http://es6.ruanyifeng.com模版改版而成。
- 原模版地址:https://github.com/ruanyf/es6tutorial
- 从零到壹全栈部落模版地址:https://github.com/liyuechun/fullstack
利用全栈部落模版快速搭建自己的电子书独立博客步骤
- 克隆代码模版
liyuechun:Desktop yuechunli$ mkdir 0714
liyuechun:Desktop yuechunli$ cd 0714/
liyuechun:0714 yuechunli$ git clone https://github.com/liyuechun/fullstack.git
Cloning into 'fullstack'...
remote: Counting objects: 1801, done.
remote: Compressing objects: 100% (130/130), done.
remote: Total 1801 (delta 72), reused 96 (delta 27), pack-reused 1644
Receiving objects: 100% (1801/1801), 2.37 MiB | 1.85 MiB/s, done.
Resolving deltas: 100% (1030/1030), done.
liyuechun:0714 yuechunli$
- 本地域名配置
利用Atom打开项目源码
liyuechun:0714 yuechunli$ ls
fullstack
liyuechun:0714 yuechunli$ cd fullstack/
liyuechun:fullstack yuechunli$ Atom ./
liyuechun:fullstack yuechunli$
如下图所示,找到CNAME
文件。
重要:将fullstack.kongyixueyuan.com
替换成你自己已经购买并且备案了的域名–域名不备案,可能不能用,所以最好备案。
- github项目创建与key配置
操作步骤如下:
1、在github账号里面新建一个叫做fullstack
的项目
2、配置keys
首先打开终端,按照如下命令操作即可。
liyuechun:fullstack yuechunli$ ssh-keygen -t rsa -C "liyuechun2009@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/liyuechun/.ssh/id_rsa):
/Users/liyuechun/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/liyuechun/.ssh/id_rsa.
Your public key has been saved in /Users/liyuechun/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:3sUmB0vDLrm7fFLB2QKuApm5/qBG/CQUXqGGm95+W+0 liyuechun2009@163.com
The key's randomart image is:
+---[RSA 2048]----+
| .. |
|.... .. |
|ooo+ . o=o |
|.== .+==. |
|= o .S +o= |
|.+o.. ...+.= |
|.o=. . .oo. |
| ooo ...o.. |
|o oo.. +E |
+----[SHA256]-----+
liyuechun:fullstack yuechunli$
ssh-keygen -t rsa -C "liyuechun2009@163.com"
中的邮箱地址换成你github账号登陆的邮箱。
下一步,用cat /Users/liyuechun/.ssh/id_rsa.pub
查看key。
liyuechun:fullstack yuechunli$ cat /Users/liyuechun/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjxv+5+fT2ASfQwIy5eDsYb7WRT73ExXtdC+IO7T994IVOkUvWyE1yUP1KEqbUVKzAFmu8XITtAe8W/ZWff4sprOFPCNc5yfTFEACIM5N1L2R5UJcXb0x+ZIWg/Dkc2ybFbg01MWPAEWvHfSzSJKuvVySwT91wOsWG+wqE60hPJk59AmFIDs8sB1z+Q+QBjgvYfn2jv5Mg1IMjEGLLxedSCEXhmRKfGOMAU5RptACEZdh/t0/rPRf7Q4SiQJ5i6rdtIaotWdv/AUQjZuUxrJrBKcIEhf6ohUm8i4Bp6PD2vur/CgQ1bhXOCI2UJJzQGtIaJdeXyKaKObU5EKDzwROB liyuechun2009@163.com
liyuechun:fullstack yuechunli$
接下来拷贝拷贝key。
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjxv+5+fT2ASfQwIy5eDsYb7WRT73ExXtdC+IO7T994IVOkUvWyE1yUP1KEqbUVKzAFmu8XITtAe8W/ZWff4sprOFPCNc5yfTFEACIM5N1L2R5UJcXb0x+ZIWg/Dkc2ybFbg01MWPAEWvHfSzSJKuvVySwT91wOsWG+wqE60hPJk59AmFIDs8sB1z+Q+QBjgvYfn2jv5Mg1IMjEGLLxedSCEXhmRKfGOMAU5RptACEZdh/t0/rPRf7Q4SiQJ5i6rdtIaotWdv/AUQjZuUxrJrBKcIEhf6ohUm8i4Bp6PD2vur/CgQ1bhXOCI2UJJzQGtIaJdeXyKaKObU5EKDzwROB liyuechun2009@163.com
如下图所示,将上面拷贝的key配置到你创建的项目中。
上图中的第4步,名字随便填,第5步,将刚才拷贝的key粘贴即可。重要:第6步中必须打勾,否则一会儿代码没办法上传,接下来点击添加key即可。
将模版代码上传到github
- 在桌面新建一个blob的文件夹并克隆代码到blob
liyuechun:~ yuechunli$ pwd
/Users/liyuechun
liyuechun:~ yuechunli$ cd Desktop/
liyuechun:Desktop yuechunli$ mkdir blob
liyuechun:Desktop yuechunli$ cd blob
liyuechun:blob yuechunli$ pwd
/Users/liyuechun/Desktop/blob
liyuechun:blob yuechunli$ git clone https://github.com/liyuechun/fullstack.git
Cloning into 'fullstack'...
remote: Counting objects: 1801, done.
remote: Compressing objects: 100% (130/130), done.
remote: Total 1801 (delta 72), reused 96 (delta 27), pack-reused 1644
Receiving objects: 100% (1801/1801), 2.37 MiB | 1.62 MiB/s, done.
Resolving deltas: 100% (1030/1030), done.
liyuechun:blob yuechunli$
- 将你最上面已经克隆到桌面并且已经修改了
CNAME
文件中域名的代码拷贝到你刚才克隆到blob中的fullstack文件夹中。
- 按照下面的操作将代码上传到github
liyuechun:fullstack yuechunli$ git add *
liyuechun:fullstack yuechunli$ git commit -m "update"
liyuechun:fullstack yuechunli$ git push -u origin master
域名解析
打开github项目查看
浏览器查看效果
浏览器打开你绑定的域名查看效果,如下图所示。
如何写博客
sidebar.md
是专门处理左边标题索引的文件,docs
里面的文件是专门写索引所对应的文章的Markdown。
PS:编辑完后,将代码提交到github即可。