Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-04-20 21:22:53 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-04-20 21:22:53 +0300
commit8f7891e70c51163185fbbd878b4925d11b6a2a93 (patch)
tree09ff03c47855d3389462f8a76e8f344fdd330fba /docs/content/en/templates
parentd3a64708f49139552ca79a199a4cbf6544375443 (diff)
parent07b8d9466dfb59c429c1b470a0443337bc0aeefe (diff)
Merge commit '07b8d9466dfb59c429c1b470a0443337bc0aeefe'
Diffstat (limited to 'docs/content/en/templates')
-rw-r--r--docs/content/en/templates/data-templates.md4
-rw-r--r--docs/content/en/templates/internal.md3
-rw-r--r--docs/content/en/templates/pagination.md8
-rw-r--r--docs/content/en/templates/partials.md3
-rw-r--r--docs/content/en/templates/robots.md48
-rw-r--r--docs/content/en/templates/rss.md6
-rw-r--r--docs/content/en/templates/taxonomy-templates.md2
7 files changed, 43 insertions, 31 deletions
diff --git a/docs/content/en/templates/data-templates.md b/docs/content/en/templates/data-templates.md
index 89f648c0f..661c0bdfa 100644
--- a/docs/content/en/templates/data-templates.md
+++ b/docs/content/en/templates/data-templates.md
@@ -51,7 +51,7 @@ The example below is a bit contrived, but it illustrates the flexibility of data
`jacopastorius.toml` contains the content below. `johnpatitucci.toml` contains a similar list:
-```
+{{< code-toggle file="jacopastorius" >}}
discography = [
"1974 – Modern American Music … Period! The Criteria Sessions",
"1974 – Jaco",
@@ -69,7 +69,7 @@ discography = [
"2003 - Punk Jazz: The Jaco Pastorius Anthology (compilation)",
"2007 - The Essential Jaco Pastorius (compilation)"
]
-```
+{{< /code-toggle >}}
The list of bass players can be accessed via `.Site.Data.jazz.bass`, a single bass player by adding the filename without the suffix, e.g. `.Site.Data.jazz.bass.jacopastorius`.
diff --git a/docs/content/en/templates/internal.md b/docs/content/en/templates/internal.md
index 13d951aa1..6f0aa9a0a 100644
--- a/docs/content/en/templates/internal.md
+++ b/docs/content/en/templates/internal.md
@@ -66,7 +66,7 @@ Hugo also ships with an internal template for [Disqus comments][disqus], a popul
### Configure Disqus
-To use Hugo's Disqus template, you first need to set a single value in your site's `config.toml` or `config.yml`:
+To use Hugo's Disqus template, you first need to set a single configuration value:
{{< code-toggle file="config" >}}
disqusShortname = "yourdiscussshortname"
@@ -152,6 +152,7 @@ tags = []
Hugo uses the page title and description for the title and description metadata.
The first 6 URLs from the `images` array are used for image metadata.
+If [page bundles](/content-management/page-bundles/) are used and the `images` array is empty or undefined, images with filenames matching `*feature*` or `*cover*,*thumbnail*` are used for image metadata.
Various optional metadata can also be set:
diff --git a/docs/content/en/templates/pagination.md b/docs/content/en/templates/pagination.md
index 5c20f8ad0..d89735f7c 100644
--- a/docs/content/en/templates/pagination.md
+++ b/docs/content/en/templates/pagination.md
@@ -24,15 +24,15 @@ The real power of Hugo pagination shines when combined with the [`where` functio
Pagination can be configured in your [site configuration][configuration]:
-`Paginate`
+`paginate`
: default = `10`. This setting can be overridden within the template.
-`PaginatePath`
+`paginatePath`
: default = `page`. Allows you to set a different path for your pagination pages.
-Setting `Paginate` to a positive value will split the list pages for the homepage, sections and taxonomies into chunks of that size. But note that the generation of the pagination pages for sections, taxonomies and homepage is *lazy* --- the pages will not be created if not referenced by a `.Paginator` (see below).
+Setting `paginate` to a positive value will split the list pages for the homepage, sections and taxonomies into chunks of that size. But note that the generation of the pagination pages for sections, taxonomies and homepage is *lazy* --- the pages will not be created if not referenced by a `.Paginator` (see below).
-`PaginatePath` is used to adapt the `URL` to the pages in the paginator (the default setting will produce URLs on the form `/page/1/`.
+`paginatePath` is used to adapt the `URL` to the pages in the paginator (the default setting will produce URLs on the form `/page/1/`.
## List Paginator Pages
diff --git a/docs/content/en/templates/partials.md b/docs/content/en/templates/partials.md
index d23622ded..a1030f6aa 100644
--- a/docs/content/en/templates/partials.md
+++ b/docs/content/en/templates/partials.md
@@ -99,7 +99,7 @@ Value: {{ partial "my-inline-partial" . }}
### Example GetFeatured
```go-html-template
{{/* layouts/partials/GetFeatured.html */}}
-{{ return first . (where site.RegularPages ".Params.featured" true) }}
+{{ return first . (where site.RegularPages "Params.featured" true) }}
```
```go-html-template
@@ -175,7 +175,6 @@ The following `header.html` partial template is used for [spf13.com](https://spf
{{ partial "head_includes.html" . }}
</head>
-<body lang="en">
{{< /code >}}
{{% note %}}
diff --git a/docs/content/en/templates/robots.md b/docs/content/en/templates/robots.md
index b06a15dd0..52a77314b 100644
--- a/docs/content/en/templates/robots.md
+++ b/docs/content/en/templates/robots.md
@@ -18,37 +18,49 @@ aliases: [/extras/robots-txt/]
toc: false
---
-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:
+To generate a robots.txt file from a template, change the [site configuration][config]:
-```
+{{< code-toggle file="config">}}
+enableRobotsTXT = true
+{{< /code-toggle >}}
+
+By default, Hugo generates robots.txt using an [internal template][internal].
+
+```text
User-agent: *
```
-## Robots.txt Template Lookup Order
+Search engines that honor the Robots Exclusion Protocol will interpret this as permission to crawl everything on the site.
-The [lookup order][lookup] for the `robots.txt` template is as follows:
+## Robots.txt Template Lookup Order
-* `/layouts/robots.txt`
-* `/themes/<THEME>/layouts/robots.txt`
+You may overwrite the internal template with a custom template. Hugo selects the template using this lookup order:
-{{% note %}}
-If you do not want Hugo to create a default `robots.txt` or leverage the `robots.txt` template, you can hand code your own and place the file in `static`. Remember that everything in the [static directory](/getting-started/directory-structure/) is copied over as-is when Hugo builds your site.
-{{% /note %}}
+1. `/layouts/robots.txt`
+2. `/themes/<THEME>/layouts/robots.txt`
## Robots.txt Template Example
-The following is an example `robots.txt` layout:
-
{{< code file="layouts/robots.txt" download="robots.txt" >}}
User-agent: *
-
-{{range .Pages}}
-Disallow: {{.RelPermalink}}
-{{end}}
+{{ range .Pages }}
+Disallow: {{ .RelPermalink }}
+{{ end }}
{{< /code >}}
-This template disallows all the pages of the site by creating one `Disallow` entry for each page.
+This template creates a robots.txt file with a `Disallow` directive for each page on the site. Search engines that honor the Robots Exclusion Protocol will not crawl any page on the site.
+
+{{% note %}}
+To create a robots.txt file without using a template:
+
+1. Set `enableRobotsTXT` to `false` in the [site configuration][config].
+2. Create a robots.txt file in the `static` directory.
+
+Remember that Hugo copies everything in the [static directory][static] to the root of `publishDir` (typically `public`) when you build your site.
+
+[config]: /getting-started/configuration/
+[static]: /getting-started/directory-structure/
+{{% /note %}}
[config]: /getting-started/configuration/
-[lookup]: /templates/lookup-order/
-[robots]: https://www.robotstxt.org/
+[internal]: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/robots.txt
diff --git a/docs/content/en/templates/rss.md b/docs/content/en/templates/rss.md
index 0eba97470..009ba241a 100644
--- a/docs/content/en/templates/rss.md
+++ b/docs/content/en/templates/rss.md
@@ -43,15 +43,15 @@ The table below shows the RSS template lookup order for the different page kinds
By default, Hugo will create an unlimited number of RSS entries. You can limit the number of articles included in the built-in RSS templates by assigning a numeric value to `rssLimit:` field in your project's [`config` file][config].
-The following values will also be included in the RSS output if specified in your site’s configuration:
+The following values will also be included in the RSS output if specified:
-```toml
+{{< code-toggle file="config" >}}
languageCode = "en-us"
copyright = "This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License."
[author]
name = "My Name Here"
-```
+{{< /code-toggle >}}
## The Embedded rss.xml
diff --git a/docs/content/en/templates/taxonomy-templates.md b/docs/content/en/templates/taxonomy-templates.md
index b04a2e43f..a265b68d0 100644
--- a/docs/content/en/templates/taxonomy-templates.md
+++ b/docs/content/en/templates/taxonomy-templates.md
@@ -206,7 +206,7 @@ Because we are leveraging the front matter system to define taxonomies for conte
<ul>
{{ range (.GetTerms "tags") }}
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
- {{ end }}
+ {{ end }}
</ul>
```