---
layout: post
title: "从0开始利用github pages搭建个人博客"
date: 2019-11-22
tags: [geek]
comments: true
author: lemonchann
---
用github pages 来写博客非常简单,搭建也是十分容易。follow me.
## 建立博客Git仓库
首先你要在[github](https://github.com/)上有自己博客仓库,用来生成和存放博客文章。你可以直接fork我的博客仓库。这样你马上有了自己的博客仓库。
[点这里我的博客地址](https://github.com/lemonchann/lemonchann.github.io)

## 搜索功能集成
[Simple-Jekyll-Search](https://github.com/christian-fei/Simple-Jekyll-Search)
### 配置search.json
[复制这份代码到你博客的根目录](https://github.com/christian-fei/Simple-Jekyll-Search/blob/master/example/search.json)
这个配置文件代表可以搜索博客的标题、标签、时间、分类。
### 配置index.html
```html
```
## 搜索框样式
[html插入样式方法](https://blog.csdn.net/u014103733/article/details/72961366)
参考:[jekyll search搭建](https://cloud.tencent.com/developer/article/1119290)
## 社交链接
以增加zhihu链接为例
[svg icon仓库](https://github.com/FortAwesome/Font-Awesome/blob/516a62816c76255dc92ed55b906e9dca5a21b28b/svgs/brands/zhihu.svg)
[viewBox](https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/viewBox)
> viewBox属性的值是一个包含4个参数的列表 `min-x`, `min-y`, `width` and `height`, 以空格或者逗号分隔开, 在用户空间中指定一个矩形区域映射到给定的元素,查看属性
[深入简出 SVG 教程](https://zhuanlan.zhihu.com/p/36138381)
修改root目录下index.html
### 配置_config.yml
```yml
footer-links:
weibo: yourname #请输入你的微博个性域名 https://www.weibo.com/
zhihu: yourname #输入你知乎主页链接上的名字 https://https://www.zhihu.com/people/
```
### 修改svg-icons.html
文件路径在_include/svg-icons.html下,增加zhihu链接
```html
{% if site.footer-links.zhihu %}
{% endif %}
```
## 添加网站计数
[html颜色表](http://xh.5156edu.com/page/z1015m9220j18754.html)
[html style属性](https://www.geeksforgeeks.org/html-style-attribute/)
eg. `style="font-family:arial;color:Gainsboro;font-size:10px; text-align:right;width:200px;background-color:gray;`
### 不算子
统计原理,[官方指引](http://ibruce.info/2015/04/04/busuanzi/#more)
### 修改根目录下index.html
增加如下内容:
```html
View:
User:
```
## Google站长分析
[GoogleAnalytics](https://analytics.google.com/analytics/web/#/report-home/a152888548w216036791p206483624)
[Google Search Console]
## 如何传图片
[PicGo](https://picgo.github.io/PicGo-Doc/zh/guide/)
## 其他功能
[小功能](https://blog.csdn.net/ds19991999/article/details/81293467)
[好用的github插件](https://blog.csdn.net/u012702547/article/details/100533763)
## 网站结构
根目录的index.html生成blog首页
_include/footer.html生成侧边栏
_include/svg-icons.html生成社交头像的链接
## 问题汇总
[jekyll端口被占用EACCES](https://www.iteye.com/blog/ywsm-510670)