GitHub ↗
Customization

Overriding templates

Hooks for head and body, and replacing any template from the site.

Hooks

Two empty partials exist to be replaced:

PartialRendered
layouts/partials/hooks/head-end.htmlAt the end of <head>
layouts/partials/hooks/body-end.htmlBefore </body>
<!-- layouts/partials/hooks/head-end.html -->
<script defer data-domain="docs.example.org" src="/js/analytics.js"></script>

Any template

Hugo looks in the site’s layouts/ before the theme’s, so copying a file from the theme to the same path in the site replaces it:

TemplateWhat it draws
_default/baseof.htmlThe page skeleton
_default/single.htmlA page
_default/list.htmlA section, with its card grid
_default/home.htmlThe home page
_default/reference.htmlAn API reference page
partials/nav.htmlThe top bar and the mobile menu
partials/sidebar.htmlThe sidebar
partials/toc.htmlThe table of contents
partials/footer.htmlThe footer
partials/head.htmlEverything in <head>
_default/_markup/render-link.htmlLinks in the prose
_default/_markup/render-table.htmlTables in the prose
_default/_markup/render-codeblock-ascii.htmlASCII diagrams

Note

A copied template no longer changes when the theme does. Prefer custom.css and the hooks where they reach.

Icons

Icons are SVG files under assets/icons, inlined by name. A site adds one by putting a file in its own assets/icons/, and it is then available to section front matter, menu entries, callouts and the icon shortcode. Draw it on a 24 grid with a 2 stroke in currentColor, like the rest (Feather geometry), or it reads as a different weight beside them.