mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-17 12:24:35 -04:00
Remove static files page
This commit is contained in:
parent
27645a90f1
commit
53134e05cc
@ -1,68 +0,0 @@
|
|||||||
---
|
|
||||||
title: Static files
|
|
||||||
description: Files that get served **statically** (as-is, no modification) on the site root.
|
|
||||||
categories: [content management]
|
|
||||||
keywords: [source, directories]
|
|
||||||
menu:
|
|
||||||
docs:
|
|
||||||
parent: content-management
|
|
||||||
weight: 200
|
|
||||||
weight: 200
|
|
||||||
toc: true
|
|
||||||
aliases: [/static-files]
|
|
||||||
---
|
|
||||||
|
|
||||||
By default, the `static/` directory in the site project is used for
|
|
||||||
all **static files** (e.g. stylesheets, JavaScript, images). The static files are served on the site root path (eg. if you have the file `static/image.png` you can access it using `http://{server-url}/image.png`, to include it in a document you can use ` )`.
|
|
||||||
|
|
||||||
Hugo can be configured to look into a different directory, or even
|
|
||||||
**multiple directories** for such static files by configuring the
|
|
||||||
`staticDir` parameter in the [site configuration]. All the files in all the
|
|
||||||
static directories will form a union filesystem.
|
|
||||||
|
|
||||||
This union filesystem will be served from your site root. So a file
|
|
||||||
`<SITE PROJECT>/static/me.png` will be accessible as
|
|
||||||
`<MY_BASEURL>/me.png`.
|
|
||||||
|
|
||||||
Here's an example of setting `staticDir` and `staticDir2` for a
|
|
||||||
multi-language site:
|
|
||||||
|
|
||||||
{{< code-toggle file=hugo >}}
|
|
||||||
staticDir = ["static1", "static2"]
|
|
||||||
|
|
||||||
[languages]
|
|
||||||
[languages.en]
|
|
||||||
staticDir2 = "static_en"
|
|
||||||
baseURL = "https://example.org/"
|
|
||||||
languageName = "English"
|
|
||||||
weight = 2
|
|
||||||
title = "In English"
|
|
||||||
[languages.no]
|
|
||||||
staticDir = ["staticDir_override", "static_no"]
|
|
||||||
baseURL = "https://example.no"
|
|
||||||
languageName = "Norsk"
|
|
||||||
weight = 1
|
|
||||||
title = "På norsk"
|
|
||||||
{{</ code-toggle >}}
|
|
||||||
|
|
||||||
In the above, with no theme used:
|
|
||||||
|
|
||||||
- The English site will get its static files as a union of "static1",
|
|
||||||
"static2" and "static_en". On file duplicates, the right-most
|
|
||||||
version will win.
|
|
||||||
- The Norwegian site will get its static files as a union of
|
|
||||||
"staticDir_override" and "static_no".
|
|
||||||
|
|
||||||
Note 1
|
|
||||||
: The **2** (can be a number between 0 and 10) in `staticDir2` is
|
|
||||||
added to tell Hugo that you want to **add** this directory to the
|
|
||||||
global set of static directories defined using `staticDir`. Using
|
|
||||||
`staticDir` on the language level would replace the global value (as
|
|
||||||
can be seen in the Norwegian site case).
|
|
||||||
|
|
||||||
Note 2
|
|
||||||
: The example above is a [multihost setup]. In a regular setup, all
|
|
||||||
the static directories will be available to all sites.
|
|
||||||
|
|
||||||
[site configuration]: /getting-started/configuration/#all-configuration-settings
|
|
||||||
[multihost setup]: /content-management/multilingual/#configure-multilingual-multihost
|
|
@ -78,38 +78,49 @@ my-site/
|
|||||||
|
|
||||||
Each of the subdirectories contributes to the content, structure, behavior, or presentation of your 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/).
|
|
||||||
|
|
||||||
assets
|
The `archetypes` directory contains templates for new content. See [details](/content-management/archetypes/).
|
||||||
: 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/).
|
|
||||||
|
|
||||||
config
|
###### assets
|
||||||
: 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).
|
|
||||||
|
|
||||||
content
|
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/).
|
||||||
: The `content` directory contains the markup files (typically Markdown) and page resources that comprise the content of your site. See [details](/content-management/organization/).
|
|
||||||
|
|
||||||
data
|
###### config
|
||||||
: The `data` directory contains data files (JSON, TOML, YAML, or XML) that augment content, configuration, localization, and navigation. See [details](/content-management/data-sources/).
|
|
||||||
|
|
||||||
i18n
|
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).
|
||||||
: The `i18n` directory contains translation tables for multilingual sites. See [details](/content-management/multilingual/).
|
|
||||||
|
|
||||||
layouts
|
###### content
|
||||||
: The layouts directory contains templates to transform content, data, and resources into a complete website. See [details](/templates/).
|
|
||||||
|
|
||||||
public
|
The `content` directory contains the markup files (typically Markdown) and page resources that comprise the content of your site. See [details](/content-management/organization/).
|
||||||
: 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
|
###### data
|
||||||
: 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 `data` directory contains data files (JSON, TOML, YAML, or XML) that augment content, configuration, localization, and navigation. See [details](/content-management/data-sources/).
|
||||||
: 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](/getting-started/glossary/#page-bundle) and [asset pipelines](/hugo-pipes/introduction/), the `static` directory was also used for images, CSS, and JavaScript. See [details](/content-management/static-files/).
|
|
||||||
|
|
||||||
themes
|
###### i18n
|
||||||
: The `themes` directory contains one or more [themes](/getting-started/glossary/#theme), each in its own subdirectory.
|
|
||||||
|
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](/getting-started/glossary/#page-bundle) 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](/getting-started/glossary/#theme), each in its own subdirectory.
|
||||||
|
|
||||||
## Union file system
|
## Union file system
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user