mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
3886fc1fef
211a3c613 Prepare the forestry.io article for release 23995d6b4 Add forestry.io to showcase 3f177c94e Fix some typos (found by codespell) dc26e0a5a Clarify the default for site config files and multiple config files c87c9c62e Review and update the Site config documentation for consistency a29edc50c Fix the default value of rssLimit site config 83f3c46b0 Minor style fix 4f860d1a2 Typo capitalization fixes 7851345c8 Add docs about comments within templates d129b4a28 Make the recommendation to use partial over template consistent 6cd260a41 Update index.md a2787e1a4 Add Let’s Encrypt showcase 7e664f69e Update configuration.md 8002120f1 Update multilingual.md 702b46a62 Add documentation for the disableLanguages setting cb3d395de Fix content type reference d33226924 Update Page Kinds documentation 8203f649d Fix misformed markdown link 19e99c957 Add Section definition git-subtree-dir: docs git-subtree-split: 211a3c6136c69f49baeae6cd35e5a8853cddf710
4.3 KiB
4.3 KiB
title | linktitle | description | date | publishdate | lastmod | categories | keywords | menu | weight | sections_weight | draft | aliases | toc | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Directory Structure | Directory Structure | Hugo's CLI scaffolds a project directory structure and then takes that single directory and uses it as the input to create a complete website. | 2017-01-02 | 2017-02-01 | 2017-03-09 |
|
|
|
50 | 50 | false |
|
true |
New Site Scaffolding
{{< youtube sB0HLHjgQ7E >}}
Running the hugo new site
generator from the command line will create a directory structure with the following elements:
.
├── archetypes
├── config.toml
├── content
├── data
├── layouts
├── static
└── themes
Directory Structure Explained
The following is a high-level overview of each of the directories with links to each of their respective sections within the Hugo docs.
archetypes
- You can create new content files in Hugo using the
hugo new
command. By default, Hugo will create new content files with at leastdate
,title
(inferred from the file name), anddraft = true
. This saves time and promotes consistency for sites using multiple content types. You can create your own archetypes with custom preconfigured front matter fields as well. config.toml
- Every Hugo project should have a configuration file in TOML, YAML, or JSON format at the root. Many sites may need little to no configuration, but Hugo ships with a large number of configuration directives for more granular directions on how you want Hugo to build your website.
content
- All content for your website will live inside this directory. Each top-level folder in Hugo is considered a content section. For example, if your site has three main sections---
blog
,articles
, andtutorials
---you will have three directories atcontent/blog
,content/articles
, andcontent/tutorials
. Hugo uses sections to assign default content types. data
- This directory is used to store configuration files that can be used by Hugo when generating your website. You can write these files in YAML, JSON, or TOML format. In addition to the files you add to this folder, you can also create data templates that pull from dynamic content.
layouts
- Stores templates in the form of
.html
files that specify how views of your content will be rendered into a static website. Templates include list pages, your homepage, taxonomy templates, partials, single page templates, and more. static
- Stores all the static content for your future website: images, CSS, JavaScript, etc. When Hugo builds your site, all assets inside your static directory are copied over as-is. A good example of using the
static
folder is for verifying site ownership on Google Search Console, where you want Hugo to copy over a complete HTML file without modifying its content.
{{% note %}} From Hugo 0.31 you can have multiple static directories. {{% /note %}}
{{% note %}} Hugo does not currently ship with an asset pipeline (#3207). You can solicit support from the community in the Hugo forums or check out a few of the Hugo starter kits for examples of how Hugo developers are managing static assets. {{% /note %}}