静态博客搭建

UED前端-曹徽

部署到github pages

排名前 5 的系统有

github搭建Hexo博客

  1. github账号
  2. Node.js环境
  3. Markdown语法
  4. 个性化域名

github搭建Hexo博客

npm install -g hexo

hexo init <folder>   npm install

hexo generate

hexo server

hexo new [layout] "postName" #新建文章
spm install   #安装spm

spm doc build  #本地编译

spm doc watch  #本地预览

spm doc publish -f  #强制发布该版本部署

本地

发布

github搭建Hexo博客

hexo new "postName" #新建文章

hexo new page "pageName" #新建页面

hexo generate #生成静态页面至public目录

hexo server #开启预览访问端口(默认端口4000,'ctrl + c'关闭server)

hexo deploy #将.deploy目录部署到GitHub

_config.yml

# Deployment #部署
## Docs: http://zespia.tw/hexo/docs/deploy.html
deploy:
  type: github
  repository: git@github.com:bruce-sha/bruce-sha.github.com.git #你的GitHub Pages仓库

域名

github搭建Hexo博客

建立与你用户名对应的仓库,仓库名必须为『your_user_name.github.com』

GitHubPages默认为每个用户分配了一个二级域名『your_user_name.github.com』或『your_user_name.github.io』

在repo根目录下建立一个CNAME文件,里面写上域名即可


-在`source`文件夹内建立名为`CNAME`的文件,其内容为:

example.com

自定域名

在source文件夹内建立名为CNAME的文件。

请根据你的域名类型设定DNS。

顶级域名 (Top-level domain)

若域名类似example.com,则加入 A 记录 (A record) 204.232.175.78。CNAME文件内容为example.com。

子域名 (Subdomain)

若域名类似username.example.com,则加入 CNAME 记录 (CNAME record) username.github.com。

CNAME文件内容为username.example.com。

Hexo博客插件

Themes

图床

统计

分享

评论

自定义挂件

RSS插件

Sitemap插件

安装插件:

 

启用插件:在*hexo\_config.yml文件添加:

  npm install <plugin-name> --save

THANKS

Share

By pokerone

Share

周例会分享

  • 1,169