Remove static files page

This commit is contained in:
Joe Mooring 2024-06-14 05:45:09 -07:00 committed by GitHub
parent 27645a90f1
commit 53134e05cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 90 deletions

View File

@ -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 `![Example image](/image.png) )`.
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

View File

@ -78,38 +78,49 @@ my-site/
Each of the subdirectories contributes to the content, structure, behavior, or presentation of your site.
archetypes
: The `archetypes` directory contains templates for new content. See&nbsp;[details](/content-management/archetypes/).
###### 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&nbsp;[details](/hugo-pipes/introduction/).
The `archetypes` directory contains templates for new content. See&nbsp;[details](/content-management/archetypes/).
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&nbsp;[details](/getting-started/configuration/#configuration-directory).
###### assets
content
: The `content` directory contains the markup files (typically Markdown) and page resources that comprise the content of your site. See&nbsp;[details](/content-management/organization/).
The `assets` directory contains global resources typically passed through an asset pipeline. This includes resources such as images, CSS, Sass, JavaScript, and TypeScript. See&nbsp;[details](/hugo-pipes/introduction/).
data
: The `data` directory contains data files (JSON, TOML, YAML, or XML) that augment content, configuration, localization, and navigation. See&nbsp;[details](/content-management/data-sources/).
###### config
i18n
: The `i18n` directory contains translation tables for multilingual sites. See&nbsp;[details](/content-management/multilingual/).
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&nbsp;[details](/getting-started/configuration/#configuration-directory).
layouts
: The layouts directory contains templates to transform content, data, and resources into a complete website. See&nbsp;[details](/templates/).
###### content
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&nbsp;[details](/getting-started/usage/#build-your-site).
The `content` directory contains the markup files (typically Markdown) and page resources that comprise the content of your site. See&nbsp;[details](/content-management/organization/).
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.
###### data
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. See&nbsp;[details](/content-management/static-files/).
The `data` directory contains data files (JSON, TOML, YAML, or XML) that augment content, configuration, localization, and navigation. See&nbsp;[details](/content-management/data-sources/).
themes
: The `themes` directory contains one or more [themes](/getting-started/glossary/#theme), each in its own subdirectory.
###### i18n
The `i18n` directory contains translation tables for multilingual sites. See&nbsp;[details](/content-management/multilingual/).
###### layouts
The layouts directory contains templates to transform content, data, and resources into a complete website. See&nbsp;[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&nbsp;[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