Hugo 主题
美食书
- 作者:Kien Nguyen-Tuan
- GitHub 星星:11
- 更新时间:2024-12-24
- 许可证:MIT
- 1. 要求
- 2. 安装
- 2.1. 作为 git 模块安装
- 2.2. 作为 hugo 模块安装
- 3. 配置 & 自定义
- 3.1. 站点配置
- 3.2. 自定义
- 4. 贡献
致谢
- 深受 Recipe-Book 的启发
- 图片来自 Freepik
1. 要求
- Hugo extended 版本,版本 >= 0.128.0。
2. 安装
2.1. 作为 git 模块安装
- 导航到你的 hugo 项目根目录并运行
git submodule add https://github.com/ntk148v/hugo-cuisine-book themes/cuisine-book
- 运行 hugo(或者在配置文件中设置 theme = “cuisine-book”/theme: hugo-book)
hugo server --minify --theme cuisine-book
2.2. 作为 hugo 模块安装
你也可以将此主题作为 Hugo 模块添加,而不是 git 子模块。
- 如果尚未完成,请从初始化 hugo 模块开始
hugo mod init github.com/repo/path
- 导航到你的 hugo 项目根目录并将 [module] 部分添加到
config.toml
[module]
[[module.imports]]
path = 'github.com/ntk148v/hugo-cuisine-book'
- 加载/更新主题模块并运行 hugo
hugo mod get -u
hugo server --minify
3. 配置 & 自定义
3.1. 站点配置
- 你可以将一些配置选项添加到你的
config.toml
文件中。
# Your base url
baseURL = "http://localhost/my-title"
# Your page title
title = "my-title"
theme = "cuisine-book"
# (Optional) Set this to true to enable Author.
enableGitInfo = true
[params]
author = "Your Name"
description = "Describe about you"
# (Optional) Your logo in the header navbar which has to be stored in static folder.
# If the logo is /static/logo.png then the path would be 'logo.png'
logo = "logo.png"
# (Optional) Enable comments template on pages
# By default partials/comments.html includes Disqus template
# See https://gohugo.com.cn/content-management/comments/#configure-disqus
# Can be overwritten by same param in page frontmatter
comment = true
# Set source repository location.
repo = 'https://github.com/ntk148v/mammam'
# Enable 'Edit' links.
# Disabled by default. Uncomment to enable. Requires 'repo' param.
# Path must point to the site directory.
editpath = 'edit/master'
# Enable 'Add' links.
# Disabled by default. Uncomment to enable. Requires 'repo' param.
# Path must point to the site directory.
newpath = 'new/master'
3.2. 自定义
- 额外自定义
文件 | 描述 |
---|---|
static/favicon.png | 覆盖默认网站图标 |
assets/_custom.scss | 自定义或覆盖 scss 样式 |
assets/_fonts.scss | 用自定义字体替换默认字体(例如本地文件或像 google fonts 这样的远程文件) |
layouts/partials/comments.html | 覆盖 comments.html 模板 |
- 例如,你想更改默认站点的背景。
- 将新背景添加到
static/
,并将其命名为background.png
。 - 添加
assets/_custom.scss
- 将新背景添加到
body {
background-image: url('background.png');
}
4. 贡献
- Fork 它。
- 创建你的功能分支 (
git checkout -b my-new-feature
)。 - 提交你的更改 (
git commit -am '添加一些功能'
)。 - 推送到分支 (
git push origin my-new-feature
)。 - 创建新的拉取请求。