mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Templates copy edits
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Templates
|
||||
linktitle: Templates Overview
|
||||
description: Golang templating, template types and lookup order, shortcodes, and data.
|
||||
description: Go templating, template types and lookup order, shortcodes, and data.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
|
||||
@@ -19,8 +19,6 @@ aliases: [/templates/ace/,/templates/amber/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
Hugo natively supports Amber and Ace in addition to the powerful [Go templates][].
|
||||
|
||||
## Ace Templates
|
||||
|
||||
For template documentation, follow the links from the [Ace project](https://github.com/yosssi/ace).
|
||||
|
||||
@@ -19,7 +19,7 @@ aliases: [/templates/blocks/,/templates/base-templates-and-blocks/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
Go 1.6 includes a powerful new keyword, `block`. This construct allows you to define the outer shell of your pages' one or more master template(s) and then fill in or override portions as necessary.
|
||||
The `block` keyword allows you to define the outer shell of your pages' one or more master template(s) and then fill in or override portions as necessary.
|
||||
|
||||
## Base Template Lookup Order
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ toc: true
|
||||
|
||||
<!-- begin data files -->
|
||||
|
||||
In addition to the [built-in variables][vars] available from Hugo, you can specify your own custom data that can be accessed via templates or shortcodes.
|
||||
|
||||
Hugo supports loading data from YAML, JSON, and TOML files located in the `data` directory in the root of your Hugo project.
|
||||
|
||||
## The Data Folder
|
||||
|
||||
@@ -18,8 +18,6 @@ aliases: [/layout/homepage/,/templates/homepage-template/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
The homepage of a website often has a unique design. In Hugo, you can define your own homepage template.
|
||||
|
||||
Homepage is a `Page` and therefore has all the [page variables][pagevars] and [site variables][sitevars] available for use.
|
||||
|
||||
{{% note "The Only Required Template" %}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Custom Output Formats
|
||||
linktitle: Custom Output Formats
|
||||
description: Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, while allowing extensibility for any format your site needs.
|
||||
description: Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format.
|
||||
date: 2017-03-22
|
||||
publishdate: 2017-03-22
|
||||
lastmod: 2017-03-22
|
||||
@@ -18,8 +18,6 @@ aliases: [/templates/outputs/,/extras/output-formats/,/content-management/custom
|
||||
toc: true
|
||||
---
|
||||
|
||||
In addition to the default behavior of generating RSS feeds and HTML pages, Hugo can generate any text-based output, including e-book formats, Google AMP, and JSON search indexes, to name a few.
|
||||
|
||||
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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Pagination
|
||||
linktitle: Pagination
|
||||
description: Hugo supports pagination for your homepage, section pages, and taxonomies and shines when combined with Hugo's SQL-like operators.
|
||||
description: Hugo supports pagination for your homepage, section pages, and taxonomies.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
@@ -18,7 +18,7 @@ aliases: [/extras/pagination,/doc/pagination/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
Hugo supports pagination for your homepage, section pages, and taxonomies. Hugo's pagination features were designed with ease of use and flexibility in mind. The real power of Hugo pagination shines when combined with the [`where` function][where] and its SQL-like operators: [`first`][], [`last`][], and [`after`][]. You can even [order the content][lists] the way you've become used to with Hugo.
|
||||
The real power of Hugo pagination shines when combined with the [`where` function][where] and its SQL-like operators: [`first`][], [`last`][], and [`after`][]. You can even [order the content][lists] the way you've become used to with Hugo.
|
||||
|
||||
## Configuring Pagination
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ aliases: [/templates/partial/,/layout/chrome/,/extras/analytics/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
In practice, splitting out reusable template portions into **partial templates** to be included anywhere help keep your templating DRY.
|
||||
|
||||
## Partial Template Lookup Order
|
||||
|
||||
Partial templates---like [single page templates][singletemps] and [list page templates][listtemps]---have a specific [lookup order][]. However, partials are simpler in that Hugo will only check in two places:
|
||||
|
||||
@@ -18,8 +18,6 @@ aliases: [/extras/robots-txt/]
|
||||
toc: false
|
||||
---
|
||||
|
||||
Hugo can generate a customized [robots.txt][robots] in the same way as any other template.
|
||||
|
||||
To create your robots.txt as a template, first set the `enableRobotsTXT` value to `true` in your [configuration file][config]. By default, this option generates a robots.txt with the following content, which tells search engines that they are allowed to crawl everything:
|
||||
|
||||
```http
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Section Page Templates
|
||||
linktitle: Section Templates
|
||||
description: Templates used for section pages are lists and therefore have all the variables and methods available to list pages.
|
||||
description: Templates used for section pages are **lists** and therefore have all the variables and methods available to list pages.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
@@ -18,8 +18,6 @@ aliases: [/templates/sections/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
Templates used for section pages are *lists* and therefore have all the variables and methods available to [list pages][lists].
|
||||
|
||||
## Adding Content and Front Matter to Section Templates
|
||||
|
||||
To effectively leverage section page templates, you should first understand Hugo's [content organization](/content-management/organization/) and, specifically, the purpose of `_index.md` for adding content and front matter to section and other list pages.
|
||||
|
||||
@@ -18,8 +18,6 @@ aliases: [/layout/content/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
The primary view of content in Hugo is the single view. Hugo's default behavior is to render every Markdown file provided with a corresponding single template.
|
||||
|
||||
## Single Page Template Lookup Order
|
||||
|
||||
You can specify a [content's `type`][content type] and `layout` in a single content file's [front matter][]. However, you cannot specify `section` because this is determined based on file location (see [content section][section]).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Taxonomy Templates
|
||||
# linktitle:
|
||||
description: Taxonomy templating includes taxonomy list pages, taxonomy terms pages, and the ability to iterate through taxonomies in your single page templates as well.
|
||||
description: Taxonomy templating includes taxonomy list pages, taxonomy terms pages, and using taxonomies in your single page templates.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
|
||||
@@ -18,7 +18,7 @@ aliases: []
|
||||
toc: true
|
||||
---
|
||||
|
||||
Hugo's flexibility allows you to render alternative views for specific content. These alternative **content views** are especially useful in [list templates][lists].
|
||||
These alternative **content views** are especially useful in [list templates][lists].
|
||||
|
||||
The following are common use cases for content views:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user