mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-03 04:02:38 +00:00
c494c37a45
20d77860bRemove the calibre image action58f53654dImprove image metadata formatting (#1067)c569f3657Update theme80e6d362eUpdate themed5806cca5Update themeefc5cb227Remove broken link on "where" page (#1058)443266076Comments Alternatives (#1036)9b480ebb7Fix typo1402365eeFix included typo in build-options.md3b5a76de1Update index.md1196c7695Update index.md1887ea1edUpdate index.mdd0666e74eHugo 0.68.3d514cfac9Merge branch 'temp683'49e57362breleaser: Add release notes to /docs for release of 0.68.3fa0ac3bf1Merge branch 'temp682'46993c209Release 0.68.24c8d6d242releaser: Add release notes to /docs for release of 0.68.29694f4d36Update index.md368a03754Update index.md0d997010cMerge branch 'temp681'24138a9cdreleaser: Add release notes to /docs for release of 0.68.17dd6cc788Update index.mdb6125b4a8Update build-options.mda2dead37aRelease 0.68.07cff41348Merge branch 'temp680'b3b37959creleaser: Add release notes to /docs for release of 0.68.00f98184b0Some minify configuration adjustments02219f787Add minify configefeea7be0Allow headless bundles to list pages via $page.Pages and $page.RegularPages7950d0ad1Mention `resources` folder in the "Directory structure" docs. git-subtree-dir: docs git-subtree-split:20d77860b2
4.9 KiB
4.9 KiB
title, linktitle, description, date, publishdate, lastmod, categories, keywords, menu, weight, sections_weight, draft, aliases, toc
| 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 newcommand. 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. - [
assets][] - Stores all the files which need be processed by [Hugo Pipes]({{< ref "/hugo-pipes" >}}). Only the files whose
.Permalinkor.RelPermalinkare used will be published to thepublicdirectory. Note: assets directory is not created by default. config- Hugo ships with a large number of configuration directives.
The config directory is where those directives are stored as JSON, YAML, or TOML files. Every root setting object can stand as its own file and structured by environments.
Projects with minimal settings and no need for environment awareness can use a single
config.tomlfile at its 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. Note: config directory is not created by default.
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
.htmlfiles 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: 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
staticfolder 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 %}}
- resources
- Caches some files to speed up generation. Can be also used by template authors to distribute built SASS files, so you don't have to have the preprocessor installed. Note: resources directory is not created by default.
[assets]: {{< ref "/hugo-pipes/introduction#asset-directory" >}}