【博客】如何在Github上创建博客

【博客】如何在Github上创建博客

1. 安装nodejs

windows安装npm教程--nodejs

2. 安装hexo

npm install -g hexo-cli

3. 搭建博客

$ hexo init <folder> # Hexo 将会在指定文件夹中新建所需要的文件
$ cd <folder>
$ npm install

4. 配置

我只改了title和author,url

5. 命令

hexo new "post title with whitespace" # 新建一篇文章
hexo generate # 生成静态文件
hexo server # 启动服务器
hexo deploy # 部署网站

6. 部署到Github

  1. 创建github仓库
    打开github,新建一个repository,名称是username.github.io

  2. 安装 hexo-deployer-git

    npm install hexo-deployer-git --save
    
  3. 修改配置 _config.yml

    deploy:
      type: git
      repo: <repository url> #https://bitbucket.org/JohnSmith/johnsmith.bitbucket.io
      branch: [branch]
    
  4. 部署

    hexo deploy
    

7. 其他

选择主题

我选择的是 gstyle

插入侧边条目录

  1. 在文档的开头添加 toc:true
  2. 在主题的设置文件中 /themes/gstyle/_config.yml active_nav: false

摘要

文章摘要和截断

在想要显示的摘要之后添加 <!-- more -->

posted @ 2022-07-04 22:17  sleepyhermit  阅读(110)  评论(0)    收藏  举报