【hexo】搭建hexo博客

曾经终败给现在 2022-11-25 10:09 355阅读 0赞

准备工作

github上创建仓库

用户名+ github.io
比如我的:HappyTeemo7569.github.io

安装环境

  • git
  • Node.js
    https://nodejs.org/en/download/
  • cmder(非必须) ,我是连同laragon一起安装的

安装hexo

  1. npm install -g hexo-cli
  2. hexo init blog
  3. cd blog
  4. hexo new test_my_site //创建测试文章
  5. hexo g
  6. hexo s

打开

  1. localhost:4000

在这里插入图片描述

部署

配置文件
在这里插入图片描述
最下面编辑

  1. deploy:
  2. type: git
  3. repo: https://github.com/HappyTeemo7569/HappyTeemo7569.github.io.git
  4. branch: master

安装工具

  1. npm install hexo-deployer-git --save

报错
在这里插入图片描述
这是warning错误,是因为mac下需要 fsevents,在windows或linux环境下,请忽略这个错误。

然后

  1. hexo clean
  2. hexo g
  3. hexo d

看git历史,会有提交应该。
其实打包好的放在:
在这里插入图片描述
自己提交都可以。

小结

hexo命令

  1. Commands:
  2. clean Remove generated files and cache. 清理
  3. config Get or set configurations.
  4. deploy Deploy your website. 发布
  5. generate Generate static files. 生成静态文件
  6. help Get help on a command.
  7. init Create a new Hexo folder. 初始化项目
  8. list List the information of the site
  9. migrate Migrate your site from other system to Hexo.
  10. new Create a new post. 创建新文章
  11. publish Moves a draft post from _drafts to _posts folder.
  12. render Render files with renderer plugins.
  13. server Start the server. 本地部署
  14. version Display version information.

每次部署的步骤,可按以下三步来进行。

  1. hexo clean
  2. hexo g
  3. hexo d

换主题

我喜欢的
https://github.com/bujige/hexo-theme-yulia

  1. 3.1 安装
  2. 使用终端命令,切换到 hexo 博客的根目录,然后执行下面的命令
  3. $ git clone https://github.com/bujige/hexo-theme-yulia.git themes/yulia
  4. 3.2 配置
  5. 修改 hexo 根目录下的 _config.yml theme: yulia
  6. 3.3 更新
  7. cd themes/yulia
  8. git pull

在这里插入图片描述
OK

发表评论

表情:
评论列表 (有 0 条评论,355人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Hexo问题

    今天在照着教程搭建Hexo博客的时候在安装Hexo这一步出现了问题: ![在这里插入图片描述][watermark_type_ZmFuZ3poZW5naGVpdGk_sha

    相关 Hexo Github

    ![配图][alejandro-escamilla-9.jpg] 前言 在 搬砖 的过程中,浏览了许多 别人写的博客后,自己也萌生了写博客的念头。 其一是为了系统的整