Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'

This commit is contained in:
Bjørn Erik Pedersen
2025-04-10 13:04:51 +02:00
987 changed files with 12379 additions and 14083 deletions

View File

@@ -1,17 +1,14 @@
---
title: Directory structure
description: Each Hugo project is a directory, with subdirectories that contribute to the content, structure, behavior, and presentation of your site.
categories: [getting started,fundamentals]
keywords: [source, organization, directories]
menu:
docs:
parent: getting-started
weight: 40
weight: 40
toc: true
description: An overview of Hugo's directory structure.
categories: []
keywords: []
weight: 30
aliases: [/overview/source-directory/]
---
Each Hugo project is a directory, with subdirectories that contribute to the content, structure, behavior, and presentation of your site.
## Site skeleton
Hugo generates a project skeleton when you create a new site. For example, this command:
@@ -78,49 +75,38 @@ my-site/
Each of the subdirectories contributes to the content, structure, behavior, or presentation of your site.
###### archetypes
archetypes
: The `archetypes` directory contains templates for new content. See [details](/content-management/archetypes/).
The `archetypes` directory contains templates for new content. See [details](/content-management/archetypes/).
assets
: The `assets` directory contains global resources typically passed through an asset pipeline. This includes resources such as images, CSS, Sass, JavaScript, and TypeScript. See [details](/hugo-pipes/introduction/).
###### assets
config
: The `config` directory contains your site configuration, possibly split into multiple subdirectories and files. For projects with minimal configuration or projects that do not need to behave differently in different environments, a single configuration file named `hugo.toml` in the root of the project is sufficient. See [details](/configuration/introduction/#configuration-directory).
The `assets` directory contains global resources typically passed through an asset pipeline. This includes resources such as images, CSS, Sass, JavaScript, and TypeScript. See [details](/hugo-pipes/introduction/).
content
: The `content` directory contains the markup files (typically Markdown) and page resources that comprise the content of your site. See [details](/content-management/organization/).
###### config
data
: The `data` directory contains data files (JSON, TOML, YAML, or XML) that augment content, configuration, localization, and navigation. See [details](/content-management/data-sources/).
The `config` directory contains your site configuration, possibly split into multiple subdirectories and files. For projects with minimal configuration or projects that do not need to behave differently in different environments, a single configuration file named `hugo.toml` in the root of the project is sufficient. See [details](/getting-started/configuration/#configuration-directory).
i18n
: The `i18n` directory contains translation tables for multilingual sites. See [details](/content-management/multilingual/).
###### content
layouts
: The `layouts` directory contains templates to transform content, data, and resources into a complete website. See [details](/templates/).
The `content` directory contains the markup files (typically Markdown) and page resources that comprise the content of your site. See [details](/content-management/organization/).
public
: The `public` directory contains the published website, generated when you run the `hugo` or `hugo server` commands. Hugo recreates this directory and its content as needed. See [details](/getting-started/usage/#build-your-site).
###### data
resources
: The `resources` directory contains cached output from Hugo's asset pipelines, generated when you run the `hugo` or `hugo server` commands. By default this cache directory includes CSS and images. Hugo recreates this directory and its content as needed.
The `data` directory contains data files (JSON, TOML, YAML, or XML) that augment content, configuration, localization, and navigation. See [details](/content-management/data-sources/).
static
: The `static` directory contains files that will be copied to the `public` directory when you build your site. For example: `favicon.ico`, `robots.txt`, and files that verify site ownership. Before the introduction of [page bundles](g) and [asset pipelines](/hugo-pipes/introduction/), the `static` directory was also used for images, CSS, and JavaScript.
###### i18n
The `i18n` directory contains translation tables for multilingual sites. See [details](/content-management/multilingual/).
###### layouts
The `layouts` directory contains templates to transform content, data, and resources into a complete website. See [details](/templates/).
###### public
The `public` directory contains the published website, generated when you run the `hugo` or `hugo server` commands. Hugo recreates this directory and its content as needed. See [details](/getting-started/usage/#build-your-site).
###### resources
The `resources` directory contains cached output from Hugo's asset pipelines, generated when you run the `hugo` or `hugo server` commands. By default this cache directory includes CSS and images. Hugo recreates this directory and its content as needed.
###### static
The `static` directory contains files that will be copied to the `public` directory when you build your site. For example: `favicon.ico`, `robots.txt`, and files that verify site ownership. Before the introduction of [page bundles](g) and [asset pipelines](/hugo-pipes/introduction/), the `static` directory was also used for images, CSS, and JavaScript.
###### themes
The `themes` directory contains one or more [themes](g), each in its own subdirectory.
themes
: The `themes` directory contains one or more [themes](g), each in its own subdirectory.
## Union file system
@@ -158,11 +144,10 @@ source = '/home/user/shared-content'
target = 'content'
{{< /code-toggle >}}
{{% note %}}
When you overlay one directory on top of another, you must mount both directories.
Hugo does not follow symbolic links. If you need the functionality provided by symbolic links, use Hugo's union file system instead.
{{% /note %}}
> [!note]
> When you overlay one directory on top of another, you must mount both directories.
>
> Hugo does not follow symbolic links. If you need the functionality provided by symbolic links, use Hugo's union file system instead.
After mounting, the union file system has this structure:
@@ -185,11 +170,10 @@ home/
└── hugo.toml
```
{{% note %}}
When two or more files have the same path, the order of precedence follows the order of the mounts. For example, if the shared content directory contains `books/book-1.md`, it will be ignored because the project's `content` directory was mounted first.
{{% /note %}}
> [!note]
> When two or more files have the same path, the order of precedence follows the order of the mounts. For example, if the shared content directory contains `books/book-1.md`, it will be ignored because the project's `content` directory was mounted first.
You can mount directories to `archetypes`, `assets`, `content`, `data`, `i18n`, `layouts`, and `static`. See&nbsp;[details](/hugo-modules/configuration/#module-configuration-mounts).
You can mount directories to `archetypes`, `assets`, `content`, `data`, `i18n`, `layouts`, and `static`. See&nbsp;[details](/configuration/module/#mounts).
You can also mount directories from Git repositories using Hugo Modules. See&nbsp;[details](/hugo-modules/).