hugo/content/content-management/static-files.md
Bjørn Erik Pedersen 30c0d485ea Squashed 'docs/' changes from a042b67b5..3e663efb2
3e663efb2 Add poster for Hugo 0.31 release
b3c98ba65 Add doc about the new static dir support
2e62e4bdf Update multilingual docs for Hugo 0.31
8eff394b3 commands: Regenerate

git-subtree-dir: docs
git-subtree-split: 3e663efb2b149e243b6ecfdc439a2a2be573987f
2017-11-20 11:19:16 +01:00

1.5 KiB

title description date categories keywords menu weight aliases toc
Static Files The `static` folder is where you place all your **static files**. 2017-11-18
content management
source
directories
docs
parent weight
content-management 130
130
/static-files
true

The static folder is where you place all your static files, e.g. stylesheets, JavaScript, images etc.

You can set the name of the static folder to use in your configuration file, for example config.toml. From Hugo 0.31 you can configure as many static directories as you need. All the files in all the static directories will form a union filesystem.

Example:

staticDir = ["static1", "static2"]
[languages]
[languages.no]
staticDir = ["staticDir_override", "static_no"]
baseURL = "https://example.no"
languageName = "Norsk"
weight = 1
title = "På norsk"

[languages.en]
staticDir2 = "static_en"
baseURL = "https://example.com"
languageName = "English"
weight = 2
title = "In English"

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: The example above is a multihost setup. In a regular setup, all the static directories will be available to all sites.