Day 2 - 构建第一个 Hugo 网站
创建新站点
使用以下命令创建一个新的 Hugo 站点:
1hugo new site my-blog
2cd my-blog
目录结构
Hugo 会自动创建以下目录结构:
1my-blog/
2├── archetypes/ # 内容模板
3├── content/ # 网站内容
4├── data/ # 数据文件
5├── layouts/ # 布局模板
6├── static/ # 静态资源
7├── themes/ # 主题
8└── hugo.toml # 配置文件
添加主题
下载并安装一个主题:
1git init
2git submodule add https://github.com/xxx/theme.git themes/theme-name
在 hugo.toml 中配置主题:
1theme = "theme-name"
创建第一篇文章
1hugo new posts/my-first-post.md
启动开发服务器
1hugo server -D
访问 http://localhost:1313 查看你的网站!
下一步
下一篇我们将学习如何自定义主题样式。
— END —