基于Hugo和PaperMod主题构建的中英文双语技术博客,专注于分享日常思考、技术要点和经验总结。
- 🌍 双语支持: 完整的中文和英文界面
- 📱 响应式设计: 适配各种设备屏幕
- 🔍 全文搜索: 基于Fuse.js的快速搜索功能
- 📊 语法高亮: 支持代码块语法高亮
- 🏷️ 分类标签: 灵活的文章分类和标签系统
- 📈 SEO优化: 搜索引擎友好
- 🌙 暗色主题: 支持明暗主题切换
- Hugo Extended版本 >= 0.146.0
- Git
# macOS
brew install hugo
# 或者使用Makefile
make install-hugo# 克隆仓库
git clone <your-repo-url>
cd blog
# 启动开发服务器
make run
# 或者
hugo server
# 浏览器访问 http://localhost:1313# 创建技术文章(会同时创建中英文版本)
make new-tech-post TITLE="文章标题"
# 创建文化文章
make new-culture-post TITLE="文章标题"
# 自定义分类文章
make new-post TITLE="文章标题" CATEGORY="custom"文章使用以下目录结构:
content/
├── technology/ # 技术文章
│ ├── article.zh.md # 中文版本
│ └── article.en.md # 英文版本
├── culture/ # 文化文章
│ ├── article.zh.md
│ └── article.en.md
├── archives/ # 归档页面
└── search/ # 搜索页面
---
title: "文章标题"
date: 2024-01-15T10:00:00+08:00
categories: ["技术"]
tags: ["Go", "编程"]
author: "作者名"
description: "文章描述"
---make run # 启动开发服务器
make serve-drafts # 显示草稿文章
make serve-future # 显示未来日期文章make build # 构建静态网站
make build-minify # 构建并压缩
make build-production # 生产环境构建make list-drafts # 列出草稿文章
make list-zh-posts # 列出中文文章
make list-en-posts # 列出英文文章
make check-translations # 检查缺失翻译make stats # 显示博客统计信息
make word-count # 统计字数make clean # 清理构建文件
make clean-cache # 清理缓存
make backup # 备份内容博客使用PaperMod主题,主要配置在hugo.toml文件中:
defaultContentLanguage = 'zh'
defaultContentLanguageInSubdir = false
[languages]
[languages.zh]
languageCode = 'zh-CN'
languageName = '中文'
title = '技术博客 | 思考与分享'
weight = 1
[languages.en]
languageCode = 'en-US'
languageName = 'English'
title = 'Tech Blog | Thoughts & Sharing'
weight = 2[params]
ShowReadingTime = true # 显示阅读时间
ShowShareButtons = true # 分享按钮
ShowPostNavLinks = true # 文章导航
ShowBreadCrumbs = true # 面包屑导航
ShowCodeCopyButtons = true # 代码复制按钮
ShowToc = true # 目录# 安装Vercel CLI
npm i -g vercel
# 部署
make deploy-vercel# 安装Netlify CLI
npm install -g netlify-cli
# 部署
make deploy-netlifymake build-production
# 将public/目录内容上传到服务器blog/
├── content/ # 内容文件
├── static/ # 静态资源
├── themes/ # 主题文件
├── public/ # 构建输出
├── hugo.toml # 主配置文件
├── Makefile # 自动化脚本
└── README.md # 说明文档
如需自定义样式,可以在assets/css/目录下创建自定义CSS文件。
- 在
hugo.toml中添加新语言配置 - 创建对应的内容文件(如
.fr.md) - 更新菜单配置
在hugo.toml中配置Disqus:
[params]
disqusShortname = "your-disqus-shortname"运行make stats查看博客统计:
=== 双语博客统计 ===
总文章数: 8
中文文章: 4
英文文章: 4
技术文章: 4
文化文章: 4
草稿文章: 0
已发布文章: 8
欢迎提交Issue和Pull Request来改进这个博客模板!
此项目基于MIT许可证开源。