Hugo Shortcode Gallery 项目教程
1. 项目的目录结构及介绍
hugo-shortcode-gallery/
├── assets/
│ └── shortcode-gallery/
├── layouts/
│ └── shortcodes/
├── static/
│ └── shortcode-gallery/
├── .gitignore
├── LICENSE.md
├── README.md
├── config.toml
├── go.mod
└── theme.toml
目录结构介绍
- assets/: 存放项目的资源文件,如CSS、JavaScript等。
- shortcode-gallery/: 存放与短代码相关的资源文件。
- layouts/: 存放项目的布局文件。
- shortcodes/: 存放短代码模板文件。
- static/: 存放静态文件,如图片、字体等。
- shortcode-gallery/: 存放与短代码相关的静态文件。
- .gitignore: Git忽略文件列表。
- LICENSE.md: 项目的开源许可证文件。
- README.md: 项目的说明文档。
- config.toml: 项目的配置文件。
- go.mod: Go模块文件,定义项目的依赖关系。
- theme.toml: 主题配置文件。
2. 项目的启动文件介绍
在Hugo项目中,启动文件通常是指config.toml
文件。该文件包含了项目的全局配置,如站点标题、语言、主题等。
config.toml 示例
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "hugo-shortcode-gallery"
启动文件介绍
- baseURL: 站点的基本URL。
- languageCode: 站点的语言代码。
- title: 站点的标题。
- theme: 使用的主题名称,这里是
hugo-shortcode-gallery
。
3. 项目的配置文件介绍
项目的配置文件主要是config.toml
和theme.toml
。
config.toml
config.toml
是Hugo项目的主配置文件,包含了站点的全局配置。
theme.toml
theme.toml
是主题的配置文件,包含了主题的特定配置。
配置文件示例
# config.toml
baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "hugo-shortcode-gallery"
# theme.toml
name = "hugo-shortcode-gallery"
license = "MIT"
min_version = "0.55.0"
配置文件介绍
- baseURL: 站点的基本URL。
- languageCode: 站点的语言代码。
- title: 站点的标题。
- theme: 使用的主题名称。
- name: 主题的名称。
- license: 主题的许可证。
- min_version: 主题支持的最低Hugo版本。