Hexo

准备环境

  1. node.js

  2. git

安装hexo

安装命令:

npm install hexo-cli -g

Hexo指令大全:指令 | Hexo

安装完成后,使用cd命令进入博客文件夹(没有的话自己新建)

接着使用init博客初始化

hexo init

接着修改文件_config.yml文件,配置网站相关内容

使用Butterfly主题

Butterfly主题官网:Butterfly - A Simple and Card UI Design theme for Hexo

  1. 安装主题
    git clone -b master https://gitee.com/immyw/hexo-theme-butterfly.git themes/butterfly
  2. 使用主题
    _config.yml文件下把主题改成theme: butterfly
  3. 安装必要依赖
    npm install hexo-renderer-pug hexo-renderer-stylus --save
  4. \themes\butterfly下的文件_config.yml更名为_config.butterfly.yml并复制到博客根目录

剩下的去官方文档摸索吧,官方文档:Butterfly 安裝文檔(一) 快速開始 | Butterfly

Vercel以及部署

Github部署

  1. 设置user.name和user.email配置信息
    git config --global user.name "你的GitHub用户名"
    git config --global user.email "你的GitHub注册邮箱"
  2. 生成ssh密钥文件:
    	ssh-keygen -t rsa -C "你的GitHub注册邮箱"
    ``` 然后一直点回车就行,出现`Overwrite (y/n)? `输入`y`然后一直回车
    1. 找到密钥文件
    打开文件夹`C:\Users\用户名\.ssh`内的文件`id_rsa.pub`,用记事本打开即可,复制里面的内容
    1. Github添加SSH
    [SSH and GPG keys (github.com)](https://github.com/settings/keys) 打开网址,点击New SSH Key,title随意写,Key填写刚刚复制的内容
    1. 检查Github公钥是否设置成功
    ```shell
    ssh git@github.com
    ``` ![image.png](https://jsd1.imbai.cn/gh/3401797899/blogcdn/pics/fffcb4253a4519b31e7c15d9583757c9.png) 出现这一串即连接成功
    1. 在Github上新建一个仓库`用户名.github.io`

    1. 修改Hexo配置文件
    ```yaml
    deploy:
    type: git
    repo: git@github.com:用户名/仓库名.git
    branch: master
  3. 安装Hexo的Git部署插件
    npm install hexo-deployer-git --save
  4. 运行Hexo三件套,进行部署
    hexo clean 
    hexo g 
    hexo d
    ```	接着你就能打开`用户名.github.io`访问你的博客了
    

Vercel加速

  1. 打开vercel官网:Develop. Preview. Ship. For the best frontend teams – Vercel,使用Github账号登陆

  2. 授权完成后,点击Create a New Object
    image.png

  3. 找到博客项目,点击import,然后一直下一步
    image.png

  4. 进入DashBoard
    image.png
    如图修改,可以获得一个xxxx.vercel.app域名。(如今vercel.app已经被墙,需要使用自己的域名了 2024.4.2)