← 返回命令列表

Linux command

hugo 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create new site

hugo new site [site-name]

Build site

hugo

Create new content

hugo new content [posts/my-post.md]

Start development server

hugo server

Build with drafts included

hugo --buildDrafts

Build for production with minification

hugo --minify

Build to a specific directory

hugo -d [/path/to/output]

说明

Hugo is a fast static site generator written in Go. It builds websites from Markdown content using templates and themes. Hugo is extremely fast, building thousands of pages in seconds. It supports themes, taxonomies, and shortcodes for complex sites.

参数

new content
Create new content file.
new site
Create a new site scaffold.
server
Start built-in development server.
-b, --baseURL _URL_
Hostname and path to the root.
-D, --buildDrafts
Include content marked as draft.
-E, --buildExpired
Include expired content.
-F, --buildFuture
Include content with future publish dates.
-d, --destination _DIR_
Filesystem path to write files to.
--minify
Minify supported output formats (HTML, XML, etc.).
--gc
Run cleanup tasks after the build (remove unused cache files).
--cleanDestinationDir
Remove files from destination not found in static directories.
-t, --theme _THEME_
Theme to use.
--logLevel _LEVEL_
Log level (debug, info, warn, error).

FAQ

What is the hugo command used for?

Hugo is a fast static site generator written in Go. It builds websites from Markdown content using templates and themes. Hugo is extremely fast, building thousands of pages in seconds. It supports themes, taxonomies, and shortcodes for complex sites.

How do I run a basic hugo example?

Run `hugo new site [site-name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does new content do in hugo?

Create new content file.