Structure of a hugo theme
Hugo directory structure getting started pages.
Theme
archetypes/- collection of templatesfoo.md- templates for creating a new document of type foo usinghugo new foo/bar.md
assets/- Any assets processed by hugo pipessyntax.css- CSS for syntax highlighting of codesass/- collection of.sassfiles to be processed and made callable containing things such as:_variables.sass- commonly used variables across site, e.g. default font size, primary color, etc.custom.sass- definitions of custom CSS types for divs/ids etc. in theme.scaffold- CSS for generic html items, e.g. headers, lists, paragraphs, hyperlinks, etc.
config/- configuration files for hugo/theme parameters_default/- default configuration files to use (can have production and staging too)hugo.toml- main parameter file
content/- main content of the sitefoo/- collection of the foo items on the site
layouts/- collection of.htmlfiles that determine how.mdcontent is statically renderedindex.html- template for homepage (content/_index.md)404.html- template for 404 page-
partials/- snippets of long code that can be inserted into a.htmltemplate file -
shortcodes/- snippets of long code that can be inserted with a ‘shortcode’ into a.mdfile
Under the theme to construct a new collection we may have:
layouts/foo/single.htmllist.html
partials/foo/
-
archetypes
Useful Resources
- Partials vs. Shortcodes - J.P. Droege
-
Page bundles
- Each collection of page types appears in a content subfolder, e.g.
foo/withincontent/ - The collection can contain an
_index.mdthat acts to collect all of the items into a list.
This will be formatted according tolayouts/foo/list.html - Individual pages in the collection will be formatted according to
layouts/foo/single.html
- Each collection of page types appears in a content subfolder, e.g.