Merge commit '07b8d9466dfb59c429c1b470a0443337bc0aeefe'

This commit is contained in:
Bjørn Erik Pedersen
2021-04-20 20:22:53 +02:00
64 changed files with 250 additions and 507 deletions

View File

@@ -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`.

View File

@@ -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:

View File

@@ -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

View File

@@ -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 %}}

View File

@@ -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: *
```
Search engines that honor the Robots Exclusion Protocol will interpret this as permission to crawl everything on the site.
## Robots.txt Template Lookup Order
The [lookup order][lookup] for the `robots.txt` template is as follows:
You may overwrite the internal template with a custom template. Hugo selects the template using this lookup order:
* `/layouts/robots.txt`
* `/themes/<THEME>/layouts/robots.txt`
{{% 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/
[lookup]: /templates/lookup-order/
[robots]: https://www.robotstxt.org/
[static]: /getting-started/directory-structure/
{{% /note %}}
[config]: /getting-started/configuration/
[internal]: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/robots.txt

View File

@@ -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 sites 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

View File

@@ -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>
```