我的技术博客

记录学习与成长

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

前言

终于拥有了自己的技术博客!这篇文章记录了整个搭建过程,方便以后回顾,也希望能帮助到想搭建博客的朋友。

技术选型

组件 选择 理由
静态生成器 Hexo 中文生态好,主题丰富,文档完善
主题 NexT 简约清爽,功能强大,支持暗色模式
托管 GitHub Pages 免费,稳定,自带 HTTPS

搭建步骤

1. 环境准备

确保已安装:

  • Node.js 18+
  • Git

2. 安装 Hexo

1
2
3
npm install -g hexo-cli
hexo init blog
cd blog && npm install

3. 安装 NexT 主题

1
npm install hexo-theme-next

修改 _config.yml 启用主题:

1
theme: next

4. 配置站点信息

编辑 _config.yml

1
2
3
4
title: 我的技术博客
author: zhlifeiy35
language: zh-CN
timezone: 'Asia/Shanghai'

5. 配置主题功能

创建 _config.next.yml 文件,配置:

  • 暗色/亮色模式切换
  • 本地搜索
  • 代码高亮与复制
  • 分类和标签页面

6. 安装搜索插件

1
npm install hexo-generator-searchdb

7. 部署到 GitHub Pages

  1. 在 GitHub 创建 用户名.github.io 仓库
  2. 安装部署插件:
    1
    npm install hexo-deployer-git
  3. 配置 _config.yml
    1
    2
    3
    4
    deploy:
    type: git
    repo: https://github.com/用户名/用户名.github.io.git
    branch: main
  4. 部署:
    1
    hexo clean && hexo generate && hexo deploy

博客功能

  • 简约清爽的界面
  • 暗色/亮色模式切换
  • 本地搜索
  • 代码高亮与一键复制
  • 分类和标签
  • RSS 订阅
  • 评论系统(计划中)
  • 自定义域名(计划中)

日常写作流程

1
2
3
4
5
6
7
8
9
10
11
# 新建文章
hexo new post "文章标题"

# 本地预览
hexo server

# 生成并部署
hexo clean && hexo generate && hexo deploy

# 或一键部署
hexo d -g

后续计划

  • 完善 About 页面
  • 添加评论系统(Giscus)
  • 绑定自定义域名
  • 开始持续写作!

总结

整个搭建过程比想象中简单,Hexo + NexT 的组合对中文用户非常友好。从零到上线只需要不到一小时。

接下来就是开始积累内容了。技术博客不仅是知识分享的平台,更是自己成长的记录。坚持写作,持续进步!


如果这篇文章对你有帮助,欢迎在 GitHub 上 Follow 我~

0%