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

HIDDEN[1]

 

When you build a website with the hugo command, the files and directories in the static/[2] directory are simply copied to the public/ directory. Non-static files are processed by hugo and their destinations are determined by configuration settings, front matter, and layout files.

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

source in TGIH/destination in
TGIH/public/
URL (if baseURL
is ii.com/)

static/images/go-
logo_black.png

images/go-
logo_black.png

ii.com/images/go-
logo_black.png

assets/style.scss

style.css

ii.com/style.css

content/about.md

about/index.html

ii.com/about/

content/articles/one.md

articles/one/index.html

ii.com/articles/one/

The last two URLs in the URL column above, 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 four gohugo.io URLs are “pretty.”

 

See also

Infinite Ink’s #gohugo Portal is a portal to the Hugo world.

Endnotes


1. Thanks to AsciiDoc includes, a variation of this article is also in Infinite Ink’s Hugo Tutorial: Themeless & Gitless Introduction to Hugo in step 17.4.
2. In Hugo, the static directory or directories can be specified with the staticDir parameter in a config file. The default is a single directory named static.
3. The website that is created in Infinite Ink’s Hugo Tutorial uses a project root directory named TGIH (for Themeless & Gitless Introduction to Hugo).

Edit this page👍👎✍

To add a reaction or comment to this page, you need a GitHub account and your browser needs to be able to run a script that is hosted at https://utteranc.es.