The following are common use cases for content views:
You want content of every type to be shown on the home page but only with limited [summary views][summaries]. You only want a bulleted list of your content in a [taxonomy template]. Views make this very straightforward by delegating the rendering of each different type of content to the content itself. Create a content view # To create a new view, create a template in each of your different content type directories with the view name.
...
Before creating custom shortcodes, please review the [shortcodes] page in the [content management] section. Understanding the usage details will help you design and create better templates.
Introduction # Hugo provides [embedded shortcodes] for many common tasks, but you’ll likely need to create your own for more specific needs. Some examples of custom shortcodes you might develop include:
Audio players Video players Image galleries Diagrams Maps Tables And many other custom elements Directory structure # Create shortcode templates within the layouts/shortcodes directory, either at its root or organized into subdirectories.
...
Overview # Hugo’s embedded sitemap templates conform to v0.9 of the [sitemap protocol].
With a monolingual project, Hugo generates a sitemap.xml file in the root of the [publishDir] using the [embedded sitemap template].
With a multilingual project, Hugo generates:
A sitemap.xml file in the root of each site (language) using the [embedded sitemap template] A sitemap.xml file in the root of the [publishDir] using the [embedded sitemapindex template] Configuration # These are the default sitemap configuration values.
...
Configuration # By default, when you build your site, Hugo generates RSS feeds for home, section, taxonomy, and term pages. Control feed generation in your site configuration. For example, to generate feeds for home and section pages, but not for taxonomy and term pages:
hugo. yaml toml json outputs: home: - html - rss section: - html - rss taxonomy: - html term: - html [outputs] home = ['html', 'rss'] section = ['html', 'rss'] taxonomy = ['html'] term = ['html'] { "outputs": { "home": [ "html", "rss" ], "section": [ "html", "rss" ], "taxonomy": [ "html" ], "term": [ "html" ] } } To disable feed generation for all [page kinds]:
...
To render a 404 error page in the root of your site, create a 404 template in the root of the layouts directory. For example:
layouts/404.html {{ define "main" }} <h1>404 Not Found</h1> <p>The page you requested cannot be found.</p> <p> <a href="{{ .Site.Home.RelPermalink }}"> Return to the home page </a> </p> {{ end }} For multilingual sites, add the language key to the file name:
layouts/ ├── 404.de.html ├── 404.
...
To generate a robots.txt file from a template, change the [site configuration]:
hugo. yaml toml json enableRobotsTXT: true enableRobotsTXT = true { "enableRobotsTXT": true } By default, Hugo generates robots.txt using an [embedded template].
User-agent: * Search engines that honor the Robots Exclusion Protocol will interpret this as permission to crawl everything on the site.
robots.txt template lookup order # You may overwrite the internal template with a custom template.
...
Overview # After [defining menu entries], use [menu methods] to render a menu.
Three factors determine how to render a menu:
The method used to define the menu entries: [automatic], [in front matter], or [in site configuration] The menu structure: flat or nested The method used to The example below handles every combination.
Example # This partial template recursively “walks” a menu structure, rendering a localized, accessible nested list.
...
Displaying a large page collection on a list page is not user-friendly:
A massive list can be intimidating and difficult to navigate. Users may get lost in the sheer volume of information. Large pages take longer to load, which can frustrate users and lead to them abandoning the site. Without any filtering or organization, finding a specific item becomes a tedious scrolling exercise. Improve usability by paginating home, section, taxonomy, and term pages.
...
Disqus # To override Hugo’s embedded Disqus template, copy the [source code] to a file with the same name in the layouts/partials directory, then call it from your templates using the [partial] function:
{{ partial "disqus.html" . }}
Hugo includes an embedded template for [Disqus], a popular commenting system for both static and dynamic websites. To effectively use Disqus, secure a Disqus “shortname” by [signing up] for the free service.
...
This page describes how to properly configure your site with the media types and output formats, as well as where to create your templates for your custom outputs.
Media types # A [media type] (formerly known as a MIME type) is a two-part identifier for file formats and format contents transmitted on the internet.
This is the full set of built-in media types in Hugo:
Notes:
It is possible to add custom media types or change the defaults; e.
...