Getting Started

Quick start (快速启动)

In this tutorial(教程) you will: Create a site 创建站点 Add content 添加内容 Configure the site 配置站点 Publish the site 发布网站 Prerequisites 先决条件 # Before you begin this tutorial you must: 在开始本教程之前,你必须 [Install Hugo] (extended or extended/deploy edition, v0.128.0 or later) 安装Hugo 扩展/部署版本 v0.128.0或者更高版本 [Install Git] 安装git You must also be comfortable working from the command line. 你必须能熟练使用命令行进行工作 Create a site 创建站点 # Commands 命令 # If you are a Windows user: 如果是windows用户 ...

Basic usage (基础用法)

Test your installation 测试安装 # After [installing] Hugo, test your installation by running: 安装Hugo后,运行以下命令测试您的安装: hugo version You should see something like: 你应该看到类似这样的内容: hugo v0.123.0-3c8a4713908e48e6523f058ca126710397aa4ed5+extended linux/amd64 BuildDate=2024-02-19T16:32:38Z VendorInfo=gohugoio Display available commands 显示可用命令 # To see a list of the available commands and flags: hugo help To get help with a subcommand, use the --help flag. For example: hugo server --help Build your site 建立您的网站 # To build your site, cd into your project directory and run: ...

Directory structure (目录结构)

Site skeleton # Hugo generates a project skeleton when you create a new site. For example, this command: hugo new site my-site Creates this directory structure: my-site/ ├── archetypes/ │ └── default.md ├── assets/ ├── content/ ├── data/ ├── i18n/ ├── layouts/ ├── static/ ├── themes/ └── hugo.toml <-- site configuration Depending on requirements, you may wish to organize your site configuration into subdirectories: my-site/ ├── archetypes/ │ └── default. ...

Configure Hugo 配置

Configuration file 配置文件 # Create a site configuration file in the root of your project directory, naming it hugo.toml, hugo.yaml, or hugo.json, with that order of precedence. my-project/ └── hugo.toml With v0.109.0 and earlier the basename of the site configuration file was config instead of hugo. You can use either, but should transition to the new naming convention when practical. A simple example: hugo. yaml   toml   json   baseURL: https://example. ...