Partials on Hugo

Talha Abdur Rahman
featurepreneur
Published in
2 min readAug 17, 2021
Photo by Jackson So on Unsplash

The Popular Static site generator HUGO has gained huge Traction throughout the years, smoking out it’s giant competitors like jekyll , etc. if we were to take a moment now and pen down everything we love about hugo, it’s going to be a long day

One of the great things that I came across when building a not so complex site with hugo was the concept of partials. prior to my discovery of this feature , i had this habit of making small changes to the site after it was generated by hugo. for ex, slight footer modification or maybe even a logo revamp. This made my job a lot messier

well, thanks to an awesome feature that hugo provides, known as partial content editing, you can now specify slight modifications to your site to stand out from the base template.

Partial Template Lookup Order

Partial templates — like single page templates and list page templates — have a specific lookup order. However, partials are simpler in that Hugo will only check in two places:

  1. layouts/partials/*<PARTIALNAME>.html
  2. themes/<THEME>/layouts/partials/*<PARTIALNAME>.html

This allows a theme’s end user to copy a partial’s contents into a file of the same name for further customization.

So, the next time you build a hugo site, just know that you can customize almost everything, remember , it’s your site

--

--