Categories 新闻动态

效果预览:准备开始前

准备:

  1. Windows电脑
  2. GitHub账号
  3. 使用hexo框架搭建个人博客软件

步骤一:

安装Git

  • 根据安装教程进行安装,过程简单易懂。

安装Node.js

  • 点击依次安装即可。

步骤二:

安装Hexo

  • 在Git中进行以下检测:
    • node -v: 返回版本号
    • npm -v: 返回版本号

安装淘宝的镜像源(如果遇到问题,不要害怕,多试几次)

  • npminstall --save hexo-deployer-git --registry=https://registry.npm.taobao.org/

创建一个仓库(repository):(例:yourname.github.io)

步骤三:

在Blog目录下安装hexo部署插件

  • npm install --save hexo-deployer-git

找到_config.yml文件

  • 使用编译器打开,建议使用VisualStudio Code

更改代码:

# Theme configuration
theme: 
  # theme name, such as 'simple'
  name: 主题名称
  repository:
    type: git
    repo: https://github.com/yourname/yourname.github.io.git
    branch: master

保存更改,然后在Git里面输入hexo d将本地文件部署到GitHub上。

步骤四:

访问https://+自己的仓库名 即可访问您的个人网站。

进一步操作(更换主题以yilia为例):

  1. 下载yilia主题
    git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia

  2. 打开_config.yml文件,将theme: yilia更改为主题名称

  3. 清除数据库:hexo clean

  4. 生成静态网站:hexo generate

  5. 部署到GitHub:hexo deploy

通过以上步骤,您就可以成功创建并更新您的个人博客了。祝您使用愉快!