【博客】如何在Github上创建博客
阅读原文时间:2023年07月09日阅读:1

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

windows安装npm教程--nodejs

npm install -g hexo-cli


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

我只改了title和author,url

hexo new "post title with whitespace" # 新建一篇文章
hexo generate # 生成静态文件
hexo server # 启动服务器
hexo deploy # 部署网站
  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

选择主题

我选择的是 gstyle

插入侧边条目录

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

摘要

文章摘要和截断

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