Gopher

Templates

Templates

Go templating, template types and lookup order, shortcodes, and data. Read More »

Introduction to Hugo Templating

Hugo uses Go’s html/template and text/template libraries as the basis for the templating. Read More »

Hugo's Lookup Order

Hugo searches for the layout to use for a given page in a well defined order, starting from the most specific. Read More »

Custom Output Formats

Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format. Read More »

Base Templates and Blocks

The base and block constructs allow you to define the outer shell of your master templates (i.e., the chrome of the page). Read More »

Lists of Content in Hugo

Lists have a specific meaning and usage in Hugo when it comes to rendering your site homepage, section page, taxonomy list, or taxonomy terms list. Read More »

Homepage Template

The homepage of a website is often formatted differently than the other pages. For this reason, Hugo makes it easy for you to define your new site’s homepage as a unique template. Read More »

Section Page Templates

Templates used for section pages are lists and therefore have all the variables and methods available to list pages. Read More »

Taxonomy Templates

Taxonomy templating includes taxonomy list pages, taxonomy terms pages, and using taxonomies in your single page templates. Read More »

Single Page Templates

The primary view of content in Hugo is the single view. Hugo will render every Markdown file provided with a corresponding single template. Read More »

Content View Templates

Hugo can render alternative views of your content, which is especially useful in list and summary views. Read More »

Data Templates

In addition to Hugo’s built-in variables, you can specify your own custom data in templates or shortcodes that pull from both local and dynamic sources. Read More »

Partial Templates

Partials are smaller, context-aware components in your list and page templates that can be used economically to keep your templating DRY. Read More »

Create Your Own Shortcodes

You can extend Hugo’s built-in shortcodes by creating your own using the same templating syntax as that for single and list pages. Read More »

Local File Templates

Hugo’s readDir and readFile functions make it easy to traverse your project’s directory structure and write file contents to your templates. Read More »

Custom 404 Page

If you know how to create a single page template, you have unlimited options for creating a custom 404. Read More »

Pagination

Hugo supports pagination for your homepage, section pages, and taxonomies. Read More »

RSS Templates

Hugo ships with its own RSS 2.0 template that requires almost no configuration, or you can create your own RSS templates. Read More »

Sitemap Template

Hugo ships with a built-in template file observing the v0.9 of the Sitemap Protocol, but you can override this template if needed. Read More »

Robots.txt File

Hugo can generate a customized robots.txt in the same way as any other template. Read More »

Internal Templates

Hugo ships with a group of boilerplate templates that cover the most common use cases for static websites. Read More »

DEPRECATED - Alternative Templating Languages

DEPRECATED - Support for Ace & Amber templating has been removed in version 0.62 Read More »

Template Debugging

You can use Go templates’ printf function to debug your Hugo templates. These snippets provide a quick and easy visualization of the variables available to you in different contexts. Read More »