美文网首页工具
个人博客-GitHub-Pages

个人博客-GitHub-Pages

作者: 闲云a | 来源:发表于2019-08-18 16:53 被阅读0次

小序

  1. 创建GitHub Pages
  2. 安装Git
  3. 安装Node.js
  4. 安装hexo

GitHub Pages

  1. 注册GitHub账号,新建仓库,仓库名格式为(用户名.github.io),用户名必须与GitHub保持一致。
  2. 仓库中点击Settings菜单,找到GitHub Pages
  3. Choose a theme

Hexo

Hexo是一个快速、简洁且高效的博客框架。使用Markdown解析文章,在几秒内,即可利用靓丽的主题生成静态网页。
Windows搭建Hexo博客系统并部署到GitHub

  1. 安装hexo本地环境,使用命令:npm install -g hexo
  2. 计算机本地新建保存博客文件夹
  3. 初始化hexo博客工程:hexo init
  4. 执行编译与预览命令后,hexo预览http://localhost:4000/

命令

命令
[hexo n “博客名称”] 新建博客

themes

主题设置

  1. 博客根目录:git clone https://github.com/theme-next/hexo-theme-next themes/next
  2. 修改站点配置文件_config.yml中theme为目标主题名称

theme-NexT

主题配置文件_config.yml

  • scheme:目前NexT支持四种Scheme
  • menu:设置菜单
  • sidebar:设置侧边栏
  • avatar:设置头像
  • favicon:设置网站缩略图

plugins

  • 安装:npm install hexo-xxx --save
  • 卸载:npm remove hexo-xxx --save

hexo部署插件

  1. npm install hexo-deployer-git --save
  2. 修改站点配置文件_config.yml,在deploy下指定仓库路径和部署的协议


    _config.yml
  3. hexo g
  4. hexo d

hexo-admin

npm install hexo-admin --save
Hexo Admin

hexo-toc

npm install hexo-toc --save
文章中添加目录,在站点配置文件_config.yml中,添加如下信息:

# 文章顶部添加<!-- toc -->,会在标题下方生成文章目录。
toc:
  maxdepth: 3
  class: toc
  slugify: transliteration
  decodeEntities: false
  anchor:
    position: after
    symbol: ''
    style: header-anchor

<font color="#ff0000">注意坑:</font>主题为NexT时,不要安装该插件,会导致sidebar中文章目录显示错误且不跳转。

jekyll

jekyll

jekyll themes

相关文章

网友评论

    本文标题:个人博客-GitHub-Pages

    本文链接:https://www.haomeiwen.com/subject/sqzrsctx.html