Hugo Source Files, Destination Files, and Pretty URLs[1]

HIDDEN[1]

 

When you build a web site with hugo, the contents of the static/[2] directory are simply copied to the public/ directory.

Non-static files are processed by hugo and their destinations are determined by layout files, configuration settings, and front matter.

The table below shows how some of the TGIH files are transformed from source to destination to URL (viewable in a web browser after deployment). The TGIH source files are discussed on Infinite Ink’s TGIH: Themeless & Gitless Introduction to Hugo in 4.1. Explore the TGIH directory.

source in TGIH/destination in
TGIH/public/
URL (if baseURL
is example.org)

static/images/go-
logo_black.png

images/go-
logo_black.png

example.org/images/go-
logo_black.png

assets/style.scss

style.css

example.org/style.css

content/about.md

about/index.html

example.org/about/

content/articles/one.md

articles/one/index.html

example.org/articles/one/

The last two URLs in the URL column, which are bolded, are called “pretty” URLs because they do not end with a file extension (.css, .html, .htm, .php, .png, .shtml, etc.).

For more about all this, see:

Note that the above three gohugo.io URLs are “pretty.”


1. Thanks to AsciiDoc includes, a variation of this article is also in Infinite Ink’s TGIH: Themeless & Gitless Introduction to Hugo in Step 17.5.
2. In Hugo, the static directory or directories can be specified with the staticDir parameter in a config file.