mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
2c0d1ccdcd
73f355ce Update theme 83ff50c2 Use example.com in examples 71292134 Add alias news > release-notes 2e15f642 Update theme 8eef09d2 Add Pygments configuration 572b9e75 Clean up the code shortcode use a1b2fd3b Remove the code fence language codes 1473b1d9 Remove redundant text b92c2042 Update theme 8f439c28 Edit contributing section in README 8bcf8a19 Add contributing section to README 4c44ee1c Fix broken content file 2bdc7710 Clarify .Data.Pages sorting in lists.md 092271c2 Use infinitive mood for main titles b9b8abef Update theme to reflect change to home page content b897b71b Change copy to use sentence case fd675ee5 Enable RSS feed for sections 060a5e27 Correct movie title in taxonomies.md 6a5ca96a Update displayed site name for Hub 22f4b7a4 Add example of starting up the local server d9612cb3 Update theme a8c3988a Update theme 4198189d Update theme 12d6b016 Update theme 2b1c4197 Update theme b6d90a1e Fix News release titles cfe751db Add some build info to README git-subtree-dir: docs git-subtree-split: 73f355ce0dd88d032062ea70067431ab980cdd8d
82 lines
4.1 KiB
Markdown
82 lines
4.1 KiB
Markdown
---
|
|
title: Directory Structure
|
|
linktitle: Directory Structure
|
|
description: 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.
|
|
date: 2017-01-02
|
|
publishdate: 2017-02-01
|
|
lastmod: 2017-03-09
|
|
categories: [getting started,fundamentals]
|
|
#tags: [source, organization, directories]
|
|
menu:
|
|
docs:
|
|
parent: "getting-started"
|
|
weight: 50
|
|
weight: 50
|
|
sections_weight: 50
|
|
draft: false
|
|
aliases: [/overview/source-directory/]
|
|
toc: true
|
|
---
|
|
|
|
## New Site Scaffolding
|
|
|
|
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 with in the Hugo docs.
|
|
|
|
[`archetypes`](/content-management/archetypes/)
|
|
: You can create new content files in Hugo using the `hugo new` command.
|
|
By default, hugo will create new content files with at least `date`, `title` (inferred from the file name), and `draft = 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`](/getting-started/configuration/)
|
|
: 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`, and `tutorials`---you will have three directories at `content/blog`, `content/articles`, and `content/tutorials`. Hugo uses sections to assign default [content types][].
|
|
|
|
[`data`](/templates/data-templates/)
|
|
: 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][lists], your [homepage][], [taxonomy templates][], [partials][], [single page templates][singles], 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][searchconsole], where you want Hugo to copy over a complete HTML file without modifying its content.
|
|
|
|
{{% note %}}
|
|
Hugo does not currently ship with an asset pipeline ([#3207](https://github.com/gohugoio/hugo/issues/3207)). You can solicit support from the community in the [Hugo forums](https://discourse.gohugo.io) or check out a few of the [Hugo starter kits](/tools/starter-kits/) for examples of how Hugo developers are managing static assets.
|
|
{{% /note %}}
|
|
|
|
|
|
[archetypes]: /content-management/archetypes/
|
|
[configuration directives]: /getting-started/configuration/#all-variables-yaml
|
|
[`content`]: /content-management/organization/
|
|
[content section]: /content-management/sections/
|
|
[content types]: /content-management/types/
|
|
[data templates]: /templates/data-templates/
|
|
[homepage]: /templates/homepage/
|
|
[`layouts`]: /templates/
|
|
[lists]: /templates/list/
|
|
[pagevars]: /variables/page/
|
|
[partials]: /templates/partials/
|
|
[searchconsole]: https://support.google.com/analytics/answer/1142414?hl=en
|
|
[singles]: /templates/single-page-templates/
|
|
[starters]: /tools/starter-kits/
|
|
[taxonomies]: /content-management/taxonomies/
|
|
[taxonomy templates]: /templates/taxonomy-templates/
|
|
[types]: /content-management/types/
|