Merge commit '07b8d9466dfb59c429c1b470a0443337bc0aeefe'

This commit is contained in:
Bjørn Erik Pedersen 2021-04-20 20:22:53 +02:00
commit 8f7891e70c
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
64 changed files with 250 additions and 507 deletions

View file

@ -9,12 +9,6 @@
margin: 0;
}
pre, .pre {
overflow-x: auto;
overflow-y: hidden;
overflow: scroll;
}
code {
padding: 0.2em;
margin: 0;
@ -23,8 +17,7 @@ code {
border-radius: 3px;
}
pre code {
pre code {
display: block;
padding: 1.5em 1.5em;
font-size: .875rem;
@ -32,7 +25,6 @@ pre code {
overflow-x: auto;
}
pre {
background-color: #fff;
color: #333;

View file

@ -4083,7 +4083,7 @@ img { max-width: 100%; }
max-width: 30em;
}
.measure-wide-l {
max-width: 34em;
max-width: 40em;
}
.measure-narrow-l {
max-width: 20em;

View file

@ -1 +1 @@
# github.com/gohugoio/gohugoioTheme v0.0.0-20210301124928-2c15837dfec3
# github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7

View file

@ -1,182 +0,0 @@
---
title: Authors
linktitle: Authors
description:
date: 2016-08-22
publishdate: 2017-03-12
lastmod: 2017-03-12
keywords: [authors]
categories: ["content management"]
menu:
docs:
parent: "content-management"
weight: 55
weight: 55 #rem
draft: true
aliases: [/content/archetypes/]
toc: true
comments: Before this page is published, need to also update both site- and page-level variables documentation.
---
Larger sites often have multiple content authors. Hugo provides standardized author profiles to organize relationships between content and content creators for sites operating under a distributed authorship model.
## Author Profiles
You can create a profile containing metadata for each author on your website. These profiles have to be saved under `data/_authors/`. The filename of the profile will later be used as an identifier. This way Hugo can associate content with one or multiple authors. An author's profile can be defined in the JSON, YAML, or TOML format.
### Example: Author Profile
Let's suppose Alice Allison is a blogger. A simple unique identifier would be `alice`. Now, we have to create a file called `alice.toml` in the `data/_authors/` directory. The following example is the standardized template written in TOML:
{{< code file="data/_authors/alice.toml" >}}
givenName = "Alice" # or firstName as alias
familyName = "Allison" # or lastName as alias
displayName = "Alice Allison"
thumbnail = "static/authors/alice-thumb.jpg"
image = "static/authors/alice-full.jpg"
shortBio = "My name is Alice and I'm a blogger."
bio = "My name is Alice and I'm a blogger... some other stuff"
email = "alice.allison@email.com"
weight = 10
[social]
facebook = "alice.allison"
twitter = "alice"
website = "www.example.com"
[params]
random = "whatever you want"
{{< /code >}}
All variables are optional but it's advised to fill all important ones (e.g. names and biography) because themes can vary in their usage.
You can store files for the `thumbnail` and `image` attributes in the `static` folder. Then add the path to the photos relative to `static`; e.g., `/static/path/to/thumbnail.jpg`.
`weight` allows you to define the order of an author in an `.Authors` list and can be accessed on list or via the `.Site.Authors` variable.
The `social` section contains all the links to the social network accounts of an author. Hugo is able to generate the account links for the most popular social networks automatically. This way, you only have to enter your username. You can find a list of all supported social networks [here](#linking-social-network-accounts-automatically). All other variables, like `website` in the example above remain untouched.
The `params` section can contain arbitrary data much like the same-named section in the config file. What it contains is up to you.
## Associate Content Through Identifiers
Earlier it was mentioned that content can be associated with an author through their corresponding identifier. In our case, blogger Alice has the identifier `alice`. In the front matter of a content file, you can create a list of identifiers and assign it to the `authors` variable. Here are examples for `alice` using YAML and TOML, respectively.
```
---
title: Why Hugo is so Awesome
date: 2016-08-22T14:27:502:00
authors: ["alice"]
---
Nothing to read here. Move along...
```
```
+++
title = Why Hugo is so Awesome
date = "2016-08-22T14:27:502:00"
authors: ["alice"]
+++
Nothing to read here. Move along...
```
Future authors who might work on this blog post can append their identifiers to the `authors` array in the front matter as well.
## Work with Templates
After a successful setup it's time to give some credit to the authors by showing them on the website. Within the templates Hugo provides a list of the author's profiles if they are listed in the `authors` variable within the front matter.
The list is accessible via the `.Authors` template variable. Printing all authors of a the blog post is straight forward:
```
{{ range .Authors }}
{{ .DisplayName }}
{{ end }}
=> Alice Allison
```
Even if there are co-authors you may only want to show the main author. For this case you can use the `.Author` template variable **(note the singular form)**. The template variable contains the profile of the author that is first listed with his identifier in the front matter.
{{% note %}}
You can find a list of all template variables to access the profile information in [Author Variables](/variables/authors/).
{{% /note %}}
### Link Social Network Accounts
As aforementioned, Hugo is able to generate links to profiles of the most popular social networks. The following social networks with their corresponding identifiers are supported: `github`, `facebook`, `twitter`, `pinterest`, `instagram`, `youtube` and `linkedin`.
This is can be done with the `.Social.URL` function. Its only parameter is the name of the social network as they are defined in the profile (e.g. `facebook`, `twitter`). Custom variables like `website` remain as they are.
Most articles feature a small section with information about the author at the end. Let's create one containing the author's name, a thumbnail, a (summarized) biography and links to all social networks:
{{< code file="layouts/partials/author-info.html" download="author-info.html" >}}
{{ with .Author }}
<h3>{{ .DisplayName }}</h3>
<img src="{{ .Thumbnail | absURL }}" alt="{{ .DisplayName }}">
<p>{{ .ShortBio }}</p>
<ul>
{{ range $network, $username := .Social }}
<li><a href="{{ $.Author.Social.URL $network }}">{{ $network }}</a></li>
{{ end }}
</ul>
{{ end }}
{{< /code >}}
## Who Published What?
That question can be answered with a list of all authors and another list containing all articles that they each have written. Now we have to translate this idea into templates. The [taxonomy][] feature allows us to logically group content based on information that they have in common; e.g. a tag or a category. Well, many articles share the same author, so this should sound familiar, right?
In order to let Hugo know that we want to group content based on their author, we have to create a new taxonomy called `author` (the name corresponds to the variable in the front matter). Here is the snippet in a `config.yaml` and `config.toml`, respectively:
```
taxonomies:
author: authors
```
```
[taxonomies]
author = "authors"
```
### List All Authors
In the next step we can create a template to list all authors of your website. Later, the list can be accessed at `www.example.com/authors/`. Create a new template in the `layouts/taxonomy/` directory called `authors.term.html`. This template will be exclusively used for this taxonomy.
{{< code file="layouts/taxonomy/author.term.html" download="author.term.html" >}}
<ul>
{{ range $author, $v := .Data.Terms }}
{{ $profile := $.Authors.Get $author }}
<li>
<a href="{{ printf "%s/%s/" $.Data.Plural $author | absURL }}">
{{ $profile.DisplayName }} - {{ $profile.ShortBio }}
</a>
</li>
{{ end }}
</ul>
{{< /code >}}
`.Data.Terms` contains the identifiers of all authors and we can range over it to create a list with all author names. The `$profile` variable gives us access to the profile of the current author. This allows you to generate a nice info box with a thumbnail, a biography and social media links, like at the [end of a blog post](#linking-social-network-accounts-automatically).
### List Each Author's Publications
Last but not least, we have to create the second list that contains all publications of an author. Each list will be shown in its own page and can be accessed at `www.example.com/authors/<IDENTIFIER>`. Replace `<IDENTIFIER>` with a valid author identifier like `alice`.
The layout for this page can be defined in the template `layouts/taxonomy/author.html`.
{{< code file="layouts/taxonomy/author.html" download="author.html" >}}
{{ range .Pages }}
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<span>written by {{ .Author.DisplayName }}</span>
{{ .Summary }}
{{ end }}
{{< /code >}}
The example above generates a simple list of all posts written by a single author. Inside the loop you've access to the complete set of [page variables][pagevars]. Therefore, you can add additional information about the current posts like the publishing date or the tags.
With a lot of content this list can quickly become very long. Consider to use the [pagination][] feature. It splits the list into smaller chunks and spreads them over multiple pages.
[pagevars]: /variables/page/
[pagination]: /templates/pagination/

View file

@ -77,9 +77,9 @@ Only the obvious non-global options can be overridden per language. Examples of
You can disable one or more languages. This can be useful when working on a new translation.
```toml
{{< code-toggle file="config" >}}
disableLanguages = ["fr", "ja"]
```
{{< /code-toggle >}}
Note that you cannot disable the default content language.
@ -330,12 +330,12 @@ From within your templates, use the `i18n` function like this:
{{ i18n "home" }}
```
The function will search for the `"home"` id from `i18n/en-US.toml` file:
The function will search for the `"home"` id:
```
{{< code-toggle file="i18n/en-US" >}}
[home]
other = "Home"
```
{{< /code-toggle >}}
The result will be
@ -345,18 +345,18 @@ Home
### Query a flexible translation with variables
Often you will want to use to the page variables in the translations strings. To do that, pass on the `.` context when calling `i18n`:
Often you will want to use the page variables in the translation strings. To do so, pass the `.` context when calling `i18n`:
```
{{ i18n "wordCount" . }}
```
The function will pass the `.` context to the `"wordCount"` id in `i18n/en-US.toml` file:
The function will pass the `.` context to the `"wordCount"` id:
```
{{< code-toggle file="i18n/en-US" >}}
[wordCount]
other = "This article has {{ .WordCount }} words."
```
{{< /code-toggle >}}
Assume `.WordCount` in the context has value is 101. The result will be:
@ -372,13 +372,13 @@ In order to meet singular/plural requirement, you must pass a dictionary (map) w
{{ i18n "readingTime" .ReadingTime }}
```
The function will read `.Count` from `.ReadingTime` and evaluate where the number is singular (`one`) or plural (`other`). After that, it will pass to `readingTime` id in `i18n/en-US.toml` file:
The function will read `.Count` from `.ReadingTime` and evaluate where the number is singular (`one`) or plural (`other`). After that, it will pass to `readingTime` id:
```
{{< code-toggle file="i18n/en-US" >}}
[readingTime]
one = "One minute to read"
other = "{{.Count}} minutes to read"
```
{{< /code-toggle >}}
Assume `.ReadingTime.Count` in the context has value of 525600. The result will be:
@ -389,7 +389,7 @@ Assume `.ReadingTime.Count` in the context has value of 525600. The result will
If `.ReadingTime.Count` in the context has value is 1. The result is:
```
One minutes to read
One minute to read
```
In case you need to pass custom data: (`(dict "Count" 25)` is minimum requirement)
@ -433,7 +433,7 @@ This technique extracts the day, month and year by specifying ``.Date.Day``, ``.
You can define your menus for each language independently. Creating multilingual menus works just like [creating regular menus][menus], except they're defined in language-specific blocks in the configuration file:
```
{{< code-toggle file="config" >}}
defaultContentLanguage = "en"
[languages.en]
@ -454,7 +454,7 @@ languageName = "Deutsch"
url = "/"
name = "Startseite"
weight = 0
```
{{< /code-toggle >}}
The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu in the current language. Note that `absLangURL` below will link to the correct locale of your website. Without it, menu entries in all languages would link to the English version, since it's the default content language that resides in the root directory.

View file

@ -33,7 +33,7 @@ The bundle documentation is **work in progress**. We will publish more comprehen
{{% /note %}}
# Organization of Content Source
## Organization of Content Source
In Hugo, your content should be organized in a manner that reflects the rendered website.

View file

@ -1,6 +1,6 @@
---
title : "Page Resources"
description : "Page Resources -- images, other pages, documents etc. -- have page-relative URLs and their own metadata."
description : "Page resources -- images, other pages, documents, etc. -- have page-relative URLs and their own metadata."
date: 2018-01-24
categories: ["content management"]
keywords: [bundle,content,resources]
@ -13,10 +13,32 @@ menu:
parent: "content-management"
weight: 31
---
Page resources are only accessible from [page bundles]({{< relref
"/content-management/page-bundles" >}}), those directories with `index.md` or
`_index.md` files at their root. Page resources are only available to the
page with which they are bundled.
Page resources are available for [page bundles]({{< relref "/content-management/page-bundles" >}}) only,
i.e. a directory with either a `index.md`, or `_index.md` file at its root. Resources are only attached to
the lowest page they are bundled with, and simple which names does not contain `index.md` are not attached any resource.
In this example, `first-post` is a page bundle with access to 10 page resources including audio, data, documents, images, and video. Although `second-post` is also a page bundle, it has no page resources and is unable to directly access the page resources associated with `first-post`.
```text
content
└── post
├── first-post
│ ├── images
│ │ ├── a.jpg
│ │ ├── b.jpg
│ │ └── c.jpg
│ ├── index.md (root of page bundle)
│ ├── latest.html
│ ├── manual.json
│ ├── notice.md
│ ├── office.mp3
│ ├── pocket.mp4
│ ├── rating.pdf
│ └── safety.txt
└── second-post
└── index.md (root of page bundle)
```
## Properties

View file

@ -64,7 +64,7 @@ and a new line with a "quoted string".` */>}}
### Shortcodes with Markdown
In Hugo `0.55` we changed how the `%` delimiter works. Shortcodes using the `%` as the outer-most delimiter will now be fully rendered when sent to the content renderer (e.g. Blackfriday for Markdown), meaning they can be part of the generated table of contents, footnotes, etc.
In Hugo `0.55` we changed how the `%` delimiter works. Shortcodes using the `%` as the outer-most delimiter will now be fully rendered when sent to the content renderer. They can be part of the generated table of contents, footnotes, etc.
If you want the old behavior, you can put the following line in the start of your shortcode template:
@ -302,8 +302,8 @@ Read a more extensive description of `ref` and `relref` in the [cross references
Assuming that standard Hugo pretty URLs are turned on.
```
<a href="/blog/neat">Neat</a>
<a href="/about/#who:c28654c202e73453784cfd2c5ab356c0">Who</a>
<a href="https://example.com/blog/neat">Neat</a>
<a href="/about/#who">Who</a>
```
### `tweet`

View file

@ -36,7 +36,7 @@ Run `hugo gen chromastyles -h` for more options. See https://xyproto.github.io/s
## Highlight Shortcode
Highlighting is carried out via the [built-in shortcode](/content-management/shortcodes/) `highlight`. `highlight` takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. Note that `highlight` is *not* used for client-side javascript highlighting.
Highlighting is carried out via the built-in [`highlight` shortcode](https://gohugo.io/content-management/shortcodes/#highlight). It takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. Note that `highlight` is *not* used for client-side javascript highlighting.
Options:

View file

@ -202,7 +202,7 @@ The following demonstrates the concept:
```
content/posts/_index.md
=> example.com/posts/index.html
=> example.com/posts/
content/posts/post-1.md
=> example.com/posts/post-1/
```

View file

@ -2,7 +2,6 @@
title: lang.NumFmt
description: "Formats a number with a given precision using the requested `negative`, `decimal`, and `grouping` options. The `options` parameter is a string consisting of `<negative> <decimal> <grouping>`."
godocref: ""
workson: []
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-08-21

View file

@ -25,14 +25,14 @@ The `AddDate` function takes three arguments in logical order of `years`, `month
Let's assume you have a file at `data/tweets.toml` that contains a list of Tweets to display on your site's homepage. The file is filled with `[[tweet]]` blocks; e.g.---
```
{{< code-toggle file="data/tweets" >}}
[[tweet]]
name = "Steve Francia"
twitter_handle = "@spf13"
quote = "I'm creator of Hugo. #metadocreference"
link = "https://twitter.com/spf13"
date = "2017-01-07T00:00:00Z"
```
{{< /code-toggle >}}
Let's assume you want to grab Tweets from the last two years and present them in a random order. In conjunction with the [`where`](/functions/where/) and [`now`](/functions/now/) functions, you can limit our range to the last two years via `now.AddDate -2 0 0`, which represents a point in time 2 years, 0 days, and 0 hours before the time of your last site build.

View file

@ -1,6 +1,6 @@
---
title: anchorize
description: Takes a string and sanitizes it the same way as Blackfriday does for markdown headers.
description: Takes a string and sanitizes it the same way as the [`defaultMarkdownHandler`](https://gohugo.io/getting-started/configuration-markup#configure-markup) does for markdown headers.
date: 2018-10-13
categories: [functions]
menu:
@ -13,8 +13,9 @@ workson: []
relatedfuncs: [humanize]
---
The template function uses the [`SanitizedAnchorName` logic from Blackfriday](https://github.com/russross/blackfriday#sanitized-anchor-names).
Since the same sanitizing logic is used as the markdown parser, you can determine the ID of a header for linking with anchor tags.
If [Goldmark](https://gohugo.io/getting-started/configuration-markup#goldmark) is set as `defaultMarkdownHandler`, the sanitizing logic adheres to the setting [`markup.goldmark.parser.autoHeadingIDType`](https://gohugo.io/getting-started/configuration-markup#goldmark). If [Blackfriday](https://gohugo.io/getting-started/configuration-markup#blackfriday) is set as `defaultMarkdownHandler`, this template function uses the [`SanitizedAnchorName` logic from Blackfriday](https://github.com/russross/blackfriday#sanitized-anchor-names) (the same applies when `markup.goldmark.parser.autoHeadingIDType` is set to `blackfriday`).
Since the `defaultMarkdownHandler` and this template function use the same sanitizing logic, you can use the latter to determine the ID of a header for linking with anchor tags.
```
{{anchorize "This is a header"}} → "this-is-a-header"

View file

@ -17,7 +17,7 @@ relatedfuncs: [Format,now,Unix,time]
deprecated: false
---
`dateFormat` converts the textual representation of the `datetime` into the specified format or returns it as a Go `time.Time` type value. These are formatted with the layout string.
`dateFormat` converts a timestamp string `INPUT` into the format specified by the `LAYOUT` string.
```
{{ dateFormat "Monday, Jan 2, 2006" "2015-01-21" }} → "Wednesday, Jan 21, 2015"
@ -27,5 +27,6 @@ deprecated: false
As of v0.19 of Hugo, the `dateFormat` function is *not* supported as part of Hugo's [multilingual feature](/content-management/multilingual/).
{{% /warning %}}
See the [`Format` function](/functions/format/) for a more complete list of date formatting options in your templates.
See [Gos Layout String](/functions/format/#gos-layout-string) to learn about how the `LAYOUT` string has to be formatted. There are also some useful examples.
See the [`time` function](/functions/time/) to convert a timestamp string to a Go `time.Time` type value.

View file

@ -2,7 +2,6 @@
title: delimit
description: Loops through any array, slice, or map and returns a string of all the values separated by a delimiter.
godocref:
workson: []
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01

View file

@ -2,7 +2,6 @@
title: dict
description: Creates a dictionary from a list of key and value pairs.
godocref:
workson: []
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-26

View file

@ -52,13 +52,13 @@ Assume you want to add a `location = ""` field to your front matter for every ar
└── provo.toml
```
Here is an example of the data inside `data/locations/oslo.toml`:
Here is an example:
```
{{< code-toggle file="data/locations/oslo" >}}
website = "https://www.oslo.kommune.no"
pop_city = 658390
pop_metro = 1717900
```
{{< /code-toggle >}}
The example we will use will be an article on Oslo, whose front matter should be set to exactly the same name as the corresponding file name in `data/locations/`:

View file

@ -2,7 +2,6 @@
title: lang.Merge
description: "Merge missing translations from other languages."
godocref: ""
workson: []
date: 2018-03-16
categories: [functions]
keywords: [multilingual]

View file

@ -23,3 +23,8 @@ aliases: []
```
{{ .Title | markdownify }}
```
*Note*: if you need [Render Hooks][], which `markdownify` doesn't currently
support, use [.RenderString](/functions/renderstring/) instead.
[Render Hooks]: /getting-started/configuration-markup/#markdown-render-hooks

View file

@ -14,14 +14,14 @@ relatedfuncs: [dict, append, reflect.IsMap, reflect.IsSlice]
aliases: []
---
Merge creates a copy of the final `MAP` and merges any preceeding `MAP` into it in reverse order.
Merge creates a copy of the final `MAP` and merges any preceding `MAP` into it in reverse order.
Key handling is case-insensitive.
An example merging two maps.
```go-html-template
{{ $default_params := dict "color" "blue" "width" "50%" "height" "25%" }}
{{ $user_params := dict "color" "red" "extra" (dict "duration" 2) }}
{{ $default_params := dict "color" "blue" "width" "50%" "height" "25%" "icon" "star" }}
{{ $user_params := dict "color" "red" "icon" "mail" "extra" (dict "duration" 2) }}
{{ $params := merge $default_params $user_params }}
```
@ -39,5 +39,3 @@ Resulting __$params__:
{{% note %}}
Regardless of depth, merging only applies to maps. For slices, use [append]({{< ref "functions/append" >}})
{{% /note %}}

View file

@ -25,7 +25,7 @@ If there is no slash in `PATH`, it returns an empty directory and the base is se
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
```
{{ $dirFile := path.Split "a/news.html" }} → $dirDile.Dir → "a/", $dirFile.File → "news.html"
{{ $dirFile := path.Split "news.html" }} → $dirDile.Dir → "", $dirDile.File → "news.html"
{{ $dirFile := path.Split "a/b/c" }} → $dirDile.Dir → "a/b/", $dirDile.File → "c"
{{ $dirFile := path.Split "a/news.html" }} → $dirFile.Dir → "a/", $dirFile.File → "news.html"
{{ $dirFile := path.Split "news.html" }} → $dirFile.Dir → "", $dirFile.File → "news.html"
{{ $dirFile := path.Split "a/b/c" }} → $dirFile.Dir → "a/b/", $dirFile.File → "c"
```

View file

@ -22,9 +22,9 @@ It should not be used for HTML from a third-party, or HTML with unclosed tags or
Given a site-wide [`config.toml`][config] with the following `copyright` value:
```
{{< code-toggle file="config" >}}
copyright = "© 2015 Jane Doe. <a href=\"https://creativecommons.org/licenses/by/4.0/\">Some rights reserved</a>."
```
{{< /code-toggle >}}
`{{ .Site.Copyright | safeHTML }}` in a template would then output:

View file

@ -21,11 +21,11 @@ aliases: []
Example: Given a site-wide `config.toml` that contains this menu entry:
```
{{< code-toggle file="config" >}}
[[menu.main]]
name = "IRC: #golang at freenode"
url = "irc://irc.freenode.net/#golang"
```
{{< /code-toggle >}}
* <span class="bad">`<a href="{{ .URL }}">` &rarr; `<a href="#ZgotmplZ">`</span>
* <span class="good">`<a {{ printf "href=%q" .URL | safeHTMLAttr }}>` &rarr; `<a href="irc://irc.freenode.net/#golang">`</span>

View file

@ -1,7 +1,7 @@
---
title: site
linktitle: site
description: The `site` function provides global access the same data as `.Site` page method
description: The `site` function provides global access to the same data as the `.Site` page method.
godocref:
date: 2021-02-11
publishdate: 2021-02-11

View file

@ -86,7 +86,7 @@ The following logical operators are available with `where`:
## Use `where` with `Booleans`
When using booleans you should not put quotation marks.
```go-html-template
{{range where .Pages ".Draft" true}}
{{range where .Pages "Draft" true}}
<p>{{.Title}}</p>
{{end}}
```
@ -95,7 +95,7 @@ When using booleans you should not put quotation marks.
## Use `where` with `intersect`
```go-html-template
{{ range where .Site.Pages ".Params.tags" "intersect" .Params.tags }}
{{ range where .Site.Pages "Params.tags" "intersect" .Params.tags }}
{{ if ne .Permalink $.Permalink }}
{{ .Render "summary" }}
{{ end }}
@ -131,7 +131,7 @@ then ranges through only the first 5 posts in that list:
You can also nest `where` clauses to drill down on lists of content by more than one parameter. The following first grabs all pages in the "blog" section and then ranges through the result of the first `where` clause and finds all pages that are *not* featured:
```go-html-template
{{ range where (where .Pages "Section" "blog" ) ".Params.featured" "!=" true }}
{{ range where (where .Pages "Section" "blog" ) "Params.featured" "!=" true }}
```
## Unset Fields
@ -146,7 +146,7 @@ Only the following operators are available for `nil`
* `!=`, `<>`, `ne`: True if the given field is set.
```go-html-template
{{ range where .Pages ".Params.specialpost" "!=" nil }}
{{ range where .Pages "Params.specialpost" "!=" nil }}
{{ .Content }}
{{ end }}
```
@ -166,12 +166,12 @@ section names to hard-coded values like `"posts"` or `"post"`.
If the user has not set this config parameter in their site config, it
will default to the _section with the most pages_.
The user can override the default in `config.toml`:
The user can override the default:
```toml
{{< code-toggle file="config" >}}
[params]
mainSections = ["blog", "docs"]
```
{{< /code-toggle >}}
[intersect]: /functions/intersect/
[wherekeyword]: https://www.techonthenet.com/sql/where.php

View file

@ -47,15 +47,15 @@ In addition to using a single site config file, one can use the `configDir` dire
- Each file represents a configuration root object, such as `params.toml` for `[Params]`, `menu(s).toml` for `[Menu]`, `languages.toml` for `[Languages]` etc...
- Each file's content must be top-level, for example:
In `config.toml` is:
```toml
[Params]
foo = "bar"
```
In `params.toml` is:
```
{{< code-toggle file="config" >}}
[Params]
foo = "bar"
```
{{< /code-toggle >}}
{{< code-toggle file="params" >}}
foo = "bar"
{{< /code-toggle >}}
- Each directory holds a group of files containing settings unique to an environment.
- Files can be localized to become language specific.
@ -325,6 +325,8 @@ useResourceCacheWhen
writeStats {{< new-in "0.69.0" >}}
: When enabled, a file named `hugo_stats.json` will be written to your project root with some aggregated data about the build, e.g. list of HTML entities published to be used to do [CSS pruning](/hugo-pipes/postprocess/#css-purging-with-postcss). If you're only using this for the production build, you should consider placing it below [config/production](/getting-started/configuration/#configuration-directory). It's also worth mentioning that, due to the nature of the partial server builds, new HTML entities will be added when you add or change them while the server is running, but the old values will not be removed until you restart the server or run a regular `hugo` build.
**Note** that the prime use case for this is purging of unused CSS; it is build for speed and there may be false positives (e.g. elements that isn't really a HTML element).
noJSConfigInAssets {{< new-in "0.78.0" >}}
: Turn off writing a `jsconfig.json` into your `/assets` folder with mapping of imports from running [js.Build](https://gohugo.io/hugo-pipes/js). This file is intended to help with intellisense/navigation inside code editors such as [VS Code](https://code.visualstudio.com/). Note that if you do not use `js.Build`, no file will be written.
@ -444,15 +446,15 @@ To set config params, prefix the name with `HUGO_PARAMS_`
Test and document setting params via JSON env var.
{{< /todo >}}
## Ignore Content Files When Rendering
## Ignore Content and Data Files when Rendering
The following statement inside `./config.toml` will cause Hugo to ignore content files ending with `.foo` and `.boo` when rendering:
To exclude specific files from the content and data directories when rendering your site, set `ignoreFiles` to one or more regular expressions.
```
ignoreFiles = [ "\\.foo$", "\\.boo$" ]
```
For example, to ignore content and data files ending with `.foo` and `.boo`:
The above is a list of regular expressions. Note that the backslash (`\`) character is escaped in this example to keep TOML happy.
{{< code-toggle >}}
ignoreFiles = [ "\\.foo$","\\.boo$"]
{{< /code-toggle >}}
## Configure Front Matter
@ -463,20 +465,20 @@ Dates are important in Hugo, and you can configure how Hugo assigns dates to you
The default configuration is:
```toml
{{< code-toggle file="config" >}}
[frontmatter]
date = ["date", "publishDate", "lastmod"]
lastmod = [":git", "lastmod", "date", "publishDate"]
publishDate = ["publishDate", "date"]
expiryDate = ["expiryDate"]
```
{{< /code-toggle >}}
If you, as an example, have a non-standard date parameter in some of your content, you can override the setting for `date`:
```toml
{{< code-toggle file="config" >}}
[frontmatter]
date = ["myDate", ":default"]
```
{{< /code-toggle >}}
The `:default` is a shortcut to the default settings. The above will set `.Date` to the date value in `myDate` if present, if not we will look in `date`,`publishDate`, `lastmod` and pick the first valid date.
@ -490,10 +492,10 @@ The special date handlers are:
An example:
```toml
{{< code-toggle file="config" >}}
[frontmatter]
lastmod = ["lastmod", ":fileModTime", ":default"]
```
{{< /code-toggle >}}
The above will try first to extract the value for `.Lastmod` starting with the `lastmod` front matter parameter, then the content file's modification timestamp. The last, `:default` should not be needed here, but Hugo will finally look for a valid date in `:git`, `date` and then `publishDate`.
@ -504,10 +506,10 @@ The above will try first to extract the value for `.Lastmod` starting with the `
An example:
```toml
{{< code-toggle file="config" >}}
[frontmatter]
date = [":filename", ":default"]
```
{{< /code-toggle >}}
The above will try first to extract the value for `.Date` from the filename, then it will look in front matter parameters `date`, `publishDate` and lastly `lastmod`.

View file

@ -65,13 +65,13 @@ First, download the theme from GitHub and add it to your site's `themes` directo
```bash
cd quickstart
git init
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
```
*Note for non-git users:*
- If you do not have git installed, you can download the archive of the latest
version of this theme from:
https://github.com/budparr/gohugo-theme-ananke/archive/master.zip
https://github.com/theNewDynamic/gohugo-theme-ananke/archive/master.zip
- Extract that .zip file to get a "gohugo-theme-ananke-master" directory.
- Rename that directory to "ananke", and move it into the "themes/" directory.
@ -163,7 +163,7 @@ Replace the `title` above with something more personal. Also, if you already hav
**Tip:** Make the changes to the site configuration or any other file in your site while the Hugo server is running, and you will see the changes in the browser right away, though you may need to [clear your cache](https://kb.iu.edu/d/ahic).
{{% /note %}}
For theme specific configuration options, see the [theme site](https://github.com/budparr/gohugo-theme-ananke).
For theme specific configuration options, see the [theme site](https://github.com/theNewDynamic/gohugo-theme-ananke).
**For further theme customization, see [Customize a Theme](/themes/customizing/).**

View file

@ -183,15 +183,11 @@ Or...
hugo server --disableLiveReload
```
The latter flag can be omitted by adding the following key-value to your `config.toml` or `config.yml` file, respectively:
The latter flag can be omitted by adding the following:
```
{{< code-toggle file="config" >}}
disableLiveReload = true
```
```
disableLiveReload: true
```
{{< /code-toggle >}}
## Deploy Your Website

View file

@ -38,7 +38,7 @@ cd your-hugo-site
In the root directory of your Hugo site, create a `.gitlab-ci.yml` file. The `.gitlab-ci.yml` configures the GitLab CI on how to build your page. Simply add the content below.
{{< code file=".gitlab-ci.yml" >}}
image: monachus/hugo
image: registry.gitlab.com/pages/hugo:latest
variables:
GIT_SUBMODULE_STRATEGY: recursive
@ -53,6 +53,10 @@ pages:
- master
{{< /code >}}
{{% note %}}
All available Hugo versions are listed [here](https://gitlab.com/pages/hugo/container_registry)
{{% /note %}}
## Push Your Hugo Website to GitLab
Next, create a new repository on GitLab. It is *not* necessary to make the repository public. In addition, you might want to add `/public` to your .gitignore file, as there is no need to push compiled assets to GitLab or keep your output website in version control.

View file

@ -65,10 +65,10 @@ You can [set Hugo version](https://www.netlify.com/blog/2017/04/11/netlify-plus-
For production:
```
{{< code-toggle file="netlify" >}}
[context.production.environment]
HUGO_VERSION = "0.53"
```
{{< /code-toggle >}}
For testing:

View file

@ -36,13 +36,13 @@ Also see the [CLI Doc](/commands/hugo_mod_init/).
The easiest way to use a Module for a theme is to import it in the config.
1. Initialize the hugo module system: `hugo mod init github.com/<your_user>/<your_project>`
2. Import the theme in your `config.toml`:
2. Import the theme:
```toml
{{< code-toggle file="config" >}}
[module]
[[module.imports]]
path = "github.com/spf13/hyde"
```
{{< /code-toggle >}}
## Update Modules

View file

@ -35,10 +35,12 @@ There are several ways to set up CSS purging with PostCSS in Hugo. If you have a
The below configuration will write a `hugo_stats.json` file to the project root as part of the build. If you're only using this for the production build, you should consider placing it below [config/production](/getting-started/configuration/#configuration-directory).
```toml
{{< code-toggle file="config" >}}
[build]
writeStats = true
```
{{< /code-toggle >}}
`postcss.config.js`
```js
const purgecss = require('@fullhuman/postcss-purgecss')({
@ -50,12 +52,10 @@ const purgecss = require('@fullhuman/postcss-purgecss')({
});
module.exports = {
plugins: [
require('tailwindcss'),
require('autoprefixer'),
...(process.env.HUGO_ENVIRONMENT === 'production' ? [ purgecss ] : [])
]
};
plugins: [
...(process.env.HUGO_ENVIRONMENT === 'production' ? [ purgecss ] : [])
]
};
```
Note that in the example above, the "CSS purge step" will only be applied to the production build. This means that you need to do something like this in your head template to build and include your CSS:

View file

@ -18,7 +18,7 @@ draft: false
In order to use Hugo Pipes function on an asset file containing Go Template magic the function `resources.ExecuteAsTemplate` must be used.
The function takes three arguments, the resource object, the resource target path and the template context.
The function takes three arguments: the resource target path, the template context, and the resource object.
```go-html-template
// assets/sass/template.scss

View file

@ -33,9 +33,9 @@ Hugo `0.18` was bringing full-parallel page rendering, so workarounds depending
With Hugo `0.19`, you can control this behaviour by turning off page types you do not want ({{<gh 2534 >}}). In its most extreme case, if you put the below setting in your [`config.toml`](/getting-started/configuration/), you will get **nothing!**:
```
{{< code-toggle file="config" >}}
disableKinds = ["page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"]
```
{{< /code-toggle >}}
### Other New Features

View file

@ -23,10 +23,12 @@ In `layouts/partials/mystyles.css`:
Then in `config.toml` (note that by using the `.Param` lookup func, we can override the color in a pages front matter if we want):
[params]
[params.colors]
main = "green"
text = "blue"
{{< code-toggle file="config" >}}
[params]
[params.colors]
main = "green"
text = "blue"
{{< /code-toggle >}}
And then in `layouts/partials/head.html` (or the partial used to include the head section into your layout):

View file

@ -8,14 +8,14 @@ images:
- images/blog/hugo-26-poster.png
---
This release brings a choice of **AP Style or Chicago Style Title Case** ([8fb594bf](https://github.com/gohugoio/hugo/commit/8fb594bfb090c017d4e5cbb2905780221e202c41) [#989](https://github.com/gohugoio/hugo/issues/989)). You can also now configure Blackfriday to render **« French Guillemets »** ([cb9dfc26](https://github.com/gohugoio/hugo/commit/cb9dfc2613ae5125cafa450097fb0f62dd3770e7) [#3725](https://github.com/gohugoio/hugo/issues/3725)). To enable French Guillemets, put this in your site `config.toml`:
This release brings a choice of **AP Style or Chicago Style Title Case** ([8fb594bf](https://github.com/gohugoio/hugo/commit/8fb594bfb090c017d4e5cbb2905780221e202c41) [#989](https://github.com/gohugoio/hugo/issues/989)). You can also now configure Blackfriday to render **« French Guillemets »** ([cb9dfc26](https://github.com/gohugoio/hugo/commit/cb9dfc2613ae5125cafa450097fb0f62dd3770e7) [#3725](https://github.com/gohugoio/hugo/issues/3725)). To enable French Guillemets:
```bash
{{< code-toggle file="config" >}}
[blackfriday]
angledQuotes = true
smartypantsQuotesNBSP = true
```
{{< /code-toggle >}}
Oh, and this release also fixes it so you should see no ugly long crashes no more when you step wrong in your templates ([794ea21e](https://github.com/gohugoio/hugo/commit/794ea21e9449b876c5514f1ce8fe61449bbe4980)).

View file

@ -25,12 +25,13 @@ Hugo now has:
## Notes
Hugo now defaults to **smart crop** when cropping images, if you don't specify it when calling `.Fill`.
You can get the old default by adding this to your `config.toml`:
You can get the old default by adding this:
```toml
{{< code-toggle file="config" >}}
[imaging]
anchor = "center"
```
{{< /code-toggle >}}
Also, we have removed the superflous anchor name from the processed filenames that does not use this anchor, so it can be wise to run `hugo --gc` once to remove unused images.
## Enhancements

View file

@ -13,7 +13,7 @@ This is a bug-fix release with a couple of important fixes. After getting feedba
It adds support for overlapping file mounts, even for the filesystems where we walk down the directory structure. One relevant example that is fixed by this release:
```toml
{{< code-toggle file="config" >}}
[module]
[[module.mounts]]
source="content1"
@ -21,7 +21,7 @@ target="content"
[[module.mounts]]
source="content2"
target="content/docs"
```
{{< /code-toggle >}}
The above is obviously both common and very useful. This was never an issue with the situations where you load a specific file/directory (e.g. `resources.Get "a/b/c/d/sunset.jpg"`).

View file

@ -6,12 +6,12 @@ description: "Native inline, recursive import support in PostCSS/Tailwind, \"dep
categories: ["Releases"]
---
This release adds [inline `@import`](/hugo-pipes/postcss/#options) support to `resources.PostCSS`, with imports relative to Hugo's virtual, composable file system. Another useful addition is the new `build` [configuration section](/getting-started/configuration/#configure-build). As an example in `config.toml`:
This release adds [inline `@import`](/hugo-pipes/postcss/#options) support to `resources.PostCSS`, with imports relative to Hugo's virtual, composable file system. Another useful addition is the new `build` [configuration section](/getting-started/configuration/#configure-build). As an example:
```toml
{{< code-toggle file="config" >}}
[build]
useResourceCacheWhen = "always"
```
{{< /code-toggle >}}
The above will tell Hugo to _always_ use the cached build resources inside `resources/_gen` for the build steps requiring a non-standard dependency (PostCSS and SCSS/SASS). Valid values are `never`, `always` and `fallback` (default).

View file

@ -10,7 +10,7 @@ The two main items in Hugo 0.67.0 is custom HTTP header support in `hugo server`
Being able to [configure HTTP headers](https://gohugo.io/getting-started/configuration/#configure-server) in your development server means that you can now verify how your site behaves with the intended Content Security Policy settings etc., e.g.:
```toml
{{< code-toggle file="config" >}}
[server]
[[server.headers]]
for = "/**.html"
@ -21,7 +21,7 @@ X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Referrer-Policy = "strict-origin-when-cross-origin"
Content-Security-Policy = "script-src localhost:1313"
```
{{< /code-toggle >}}
**Note:** This release also changes how raw HTML files inside /content is processed to be in line with the documentation. See [#7030](https://github.com/gohugoio/hugo/issues/7030).

View file

@ -46,13 +46,13 @@ We have added a `force` flag to the [server redirects](https://gohugo.io/getting
This is set to default `false`. If you want the old behaviour you need to add this flag to your configuration:
```toml
{{< code-toggle file="config" >}}
[[redirects]]
from = "/myspa/**"
to = "/myspa/"
status = 200
force = true
```
{{< /code-toggle >}}
## Enhancements

View file

@ -128,12 +128,12 @@ There are several [Hugo Modules](https://gohugo.io/hugo-modules/)-related improv
## Minify - Keep Comments
Keep comments when running `hugo --minify` with a new setting in config.toml.
Keep comments when running `hugo --minify` with a new setting:
```toml
{{< code-toggle file="config" >}}
[minify.tdewolff.html]
keepComments = true
```
{{< /code-toggle >}}
The default value for this setting is `false`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View file

@ -1,12 +1,12 @@
---
date: 2021-03-21
title: "0.82.0"
description: "0.82.0"
title: "Hugo 0.82: Mostly bugfixes"
description: "Mostly bug fixes, but some useful improvements with Markdown attributes."
categories: ["Releases"]
---
This is a small release, mostly a maintainance/bugfix release. But also notable is that you can now add custom Markdown attributes (e.g. CSS classes) to code fences ([aed7df62](https://github.com/gohugoio/hugo/commit/aed7df62a811b07b73ec5cbbf03e69e4bbf00919) [@bep](https://github.com/bep) [#8278](https://github.com/gohugoio/hugo/issues/8278)) and that you can use the attribute lists in title render hooks (`.Attributes`; see [cd0c5d7e](https://github.com/gohugoio/hugo/commit/cd0c5d7ef32cbd570af00c50ce760452381df64e) [@bep](https://github.com/bep) [#8270](https://github.com/gohugoio/hugo/issues/8270)).
This is a small release, mostly a maintainance/bugfix release. But also notable is that you can now add custom Markdown attributes (e.g. CSS classes) to code fences ([aed7df62](https://github.com/gohugoio/hugo/commit/aed7df62a811b07b73ec5cbbf03e69e4bbf00919) [@bep](https://github.com/bep) [#8278](https://github.com/gohugoio/hugo/issues/8278)) and that you can use the attribute lists in title render hooks (`.Attributes`; see [cd0c5d7e](https://github.com/gohugoio/hugo/commit/cd0c5d7ef32cbd570af00c50ce760452381df64e) [@bep](https://github.com/bep) [#8270](https://github.com/gohugoio/hugo/issues/8270)).
This release represents **28 contributions by 8 contributors** to the main Hugo code base.[@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@moorereason](https://github.com/moorereason), and [@gzagatti](https://github.com/gzagatti) for their ongoing contributions.
And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the themes site in pristine condition and to [@davidsneighbour](https://github.com/davidsneighbour), [@coliff](https://github.com/coliff) and [@kaushalmodi](https://github.com/kaushalmodi) for all the great work on the documentation site.

View file

@ -1,8 +1,8 @@
---
date: 2021-04-20
title: "Hugo 0.82.1: A couple of Bug Fixes"
description: "This version fixes a couple of bugs introduced in 0.82.0."
title: "Hugo 0.82.1: One Bug Fix"
description: "This version fixes a bug introduced in 0.82.0."
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png

View file

@ -23,7 +23,8 @@ If you navigate to https://gohugo.io and look in the Chrome developer network co
## 1. Configure Netlify Output Formats
Add a new custom media type and two new output formats to `config.toml`. For more on output formats in Hugo, see [Custom Output Formats](/templates/output-formats/).
```bash
```toml
[outputs]
home = [ "HTML", "RSS", "REDIR", "HEADERS" ]

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

View file

@ -23,6 +23,7 @@ The Hugo community uses a wide range of preferred tools and has developed plug-i
## Sublime Text
* [Hugofy](https://github.com/akmittal/Hugofy). Hugofy is a plugin for Sublime Text 3 to make life easier to use Hugo static site generator.
* [Hugo Snippets](https://packagecontrol.io/packages/Hugo%20Snippets). Hugo Snippets is a useful plugin for adding automatic snippets to Sublime Text 3.
## Visual Studio Code

View file

@ -73,7 +73,7 @@ Alternatively, you can use the new [Jekyll import command](/commands/hugo_import
## Blogger
- [blogimport](https://github.com/natefinch/blogimport) - A tool to import from Blogger posts to Hugo.
- [blogger-to-hugo](https://bitbucket.org/petraszd/blogger-to-hugo) - Another tool to import Blogger posts to Hugo. It also downloads embedded images so they will be stored locally.
- [blogger-to-hugo](https://pypi.org/project/blogger-to-hugo/) - Another tool to import Blogger posts to Hugo. It also downloads embedded images so they will be stored locally.
- [blog2md](https://github.com/palaniraja/blog2md) - Works with [exported xml](https://support.google.com/blogger/answer/41387?hl=en) file of your YOUR-TLD.blogspot.com website. It also saves comments to `YOUR-POST-NAME-comments.md` file along with posts.
- [BloggerToHugo](https://github.com/huanlin/blogger-to-hugo) - Yet another tool to import Blogger posts to Hugo. For Windows platform only, and .NET Framework 4.5 is required. See README.md before using this tool.

View file

@ -27,7 +27,7 @@ Yes you can! See [Configure with Environment Variables](/getting-started/configu
## How do I schedule posts?
1. Set `publishDate` in the page [Front Matter](/content-management/front-matter/) to a date in the future.
1. Set `publishDate` in the page [Front Matter](/content-management/front-matter/) to a datetime in the future. If you want the creation and publication datetime to be the same, it's also sufficient to only set `date`[^date-hierarchy].
2. Build and publish at intervals.
How to automate the "publish at intervals" part depends on your situation:
@ -39,6 +39,8 @@ Also see this Twitter thread:
{{< tweet 962380712027590657 >}}
[^date-hierarchy]: See [Configure Dates](https://gohugo.io/getting-started/configuration/#configure-dates) for the order in which the different date variables are complemented by each other when not explicitly set.
## Can I use the latest Hugo version on Netlify?
Yes you can! Read [this](/hosting-and-deployment/hosting-on-netlify/#configure-hugo-version-in-netlify).

View file

@ -22,7 +22,7 @@ The following is a list of site-level (aka "global") variables. Many of these va
## Get the Site object from a partial
All the methods below, e.g. `.Site.RegularPages` can also be reached via the global `site` function, e.g. `site.RegularPages`, which can be handy in partials where the `Page` object isn't easily available. {{< new-in "0.53" >}}.
All the methods below, e.g. `.Site.RegularPages` can also be reached via the global [`site`](/functions/site/) function, e.g. `site.RegularPages`, which can be handy in partials where the `Page` object isn't easily available. {{< new-in "0.53" >}}.
## Site Variables List

View file

@ -1969,22 +1969,8 @@
"output": {
"formats": [
{
"MediaType": "text/html",
"mediaType": "text/html",
"name": "HTML",
"mediaType": {
"mainType": "text",
"subType": "html",
"delimiter": ".",
"firstSuffix": {
"suffix": "html",
"fullSuffix": ".html"
},
"type": "text/html",
"string": "text/html",
"suffixes": [
"html"
]
},
"path": "",
"baseName": "index",
"rel": "canonical",
@ -1997,22 +1983,8 @@
"weight": 10
},
{
"MediaType": "text/html",
"mediaType": "text/html",
"name": "AMP",
"mediaType": {
"mainType": "text",
"subType": "html",
"delimiter": ".",
"firstSuffix": {
"suffix": "html",
"fullSuffix": ".html"
},
"type": "text/html",
"string": "text/html",
"suffixes": [
"html"
]
},
"path": "amp",
"baseName": "index",
"rel": "amphtml",
@ -2025,22 +1997,8 @@
"weight": 0
},
{
"MediaType": "text/css",
"mediaType": "text/css",
"name": "CSS",
"mediaType": {
"mainType": "text",
"subType": "css",
"delimiter": ".",
"firstSuffix": {
"suffix": "css",
"fullSuffix": ".css"
},
"type": "text/css",
"string": "text/css",
"suffixes": [
"css"
]
},
"path": "",
"baseName": "styles",
"rel": "stylesheet",
@ -2053,22 +2011,8 @@
"weight": 0
},
{
"MediaType": "text/csv",
"mediaType": "text/csv",
"name": "CSV",
"mediaType": {
"mainType": "text",
"subType": "csv",
"delimiter": ".",
"firstSuffix": {
"suffix": "csv",
"fullSuffix": ".csv"
},
"type": "text/csv",
"string": "text/csv",
"suffixes": [
"csv"
]
},
"path": "",
"baseName": "index",
"rel": "alternate",
@ -2081,22 +2025,8 @@
"weight": 0
},
{
"MediaType": "text/calendar",
"mediaType": "text/calendar",
"name": "Calendar",
"mediaType": {
"mainType": "text",
"subType": "calendar",
"delimiter": ".",
"firstSuffix": {
"suffix": "ics",
"fullSuffix": ".ics"
},
"type": "text/calendar",
"string": "text/calendar",
"suffixes": [
"ics"
]
},
"path": "",
"baseName": "index",
"rel": "alternate",
@ -2109,22 +2039,8 @@
"weight": 0
},
{
"MediaType": "application/json",
"mediaType": "application/json",
"name": "JSON",
"mediaType": {
"mainType": "application",
"subType": "json",
"delimiter": ".",
"firstSuffix": {
"suffix": "json",
"fullSuffix": ".json"
},
"type": "application/json",
"string": "application/json",
"suffixes": [
"json"
]
},
"path": "",
"baseName": "index",
"rel": "alternate",
@ -2137,22 +2053,8 @@
"weight": 0
},
{
"MediaType": "text/plain",
"mediaType": "text/plain",
"name": "ROBOTS",
"mediaType": {
"mainType": "text",
"subType": "plain",
"delimiter": ".",
"firstSuffix": {
"suffix": "txt",
"fullSuffix": ".txt"
},
"type": "text/plain",
"string": "text/plain",
"suffixes": [
"txt"
]
},
"path": "",
"baseName": "robots",
"rel": "alternate",
@ -2165,22 +2067,8 @@
"weight": 0
},
{
"MediaType": "application/rss+xml",
"mediaType": "application/rss+xml",
"name": "RSS",
"mediaType": {
"mainType": "application",
"subType": "rss",
"delimiter": ".",
"firstSuffix": {
"suffix": "xml",
"fullSuffix": ".xml"
},
"type": "application/rss+xml",
"string": "application/rss+xml",
"suffixes": [
"xml"
]
},
"path": "",
"baseName": "index",
"rel": "alternate",
@ -2193,22 +2081,8 @@
"weight": 0
},
{
"MediaType": "application/xml",
"mediaType": "application/xml",
"name": "Sitemap",
"mediaType": {
"mainType": "application",
"subType": "xml",
"delimiter": ".",
"firstSuffix": {
"suffix": "xml",
"fullSuffix": ".xml"
},
"type": "application/xml",
"string": "application/xml",
"suffixes": [
"xml"
]
},
"path": "",
"baseName": "sitemap",
"rel": "sitemap",
@ -2441,7 +2315,7 @@
]
},
{
"Example": "AMP home, French language\"",
"Example": "AMP home, French language",
"Kind": "home",
"OutputFormat": "AMP",
"Suffix": "html",

View file

@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs
go 1.12
require github.com/gohugoio/gohugoioTheme v0.0.0-20210301124928-2c15837dfec3 // indirect
require github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7 // indirect

View file

@ -25,3 +25,7 @@ github.com/gohugoio/gohugoioTheme v0.0.0-20200711112515-b0dfe471654f h1:BWJyycs4
github.com/gohugoio/gohugoioTheme v0.0.0-20200711112515-b0dfe471654f/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
github.com/gohugoio/gohugoioTheme v0.0.0-20210301124928-2c15837dfec3 h1:ShqzOFeeg54FPSuS6q8HSeTVgj2xNZRe/YS0jNbi21g=
github.com/gohugoio/gohugoioTheme v0.0.0-20210301124928-2c15837dfec3/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
github.com/gohugoio/gohugoioTheme v0.0.0-20210409065807-6383d8cbaf65 h1:EJzierSWKqwsrUXU6MaFe0J97c0e5pzl5dBNRRrV2Nc=
github.com/gohugoio/gohugoioTheme v0.0.0-20210409065807-6383d8cbaf65/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7 h1:uRCgPslaBgLYy4ANXBoPbBQVM8aNiHoxIZTKUXpkuUA=
github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=

View file

@ -20,8 +20,19 @@
{{ range $k, $v := . }}
{{ $.Scratch.Set $k $v }}
{{ end }}
{{ range $fields }}
<td>{{ $.Scratch.Get . }}</td>
{{ range $k, $v := $fields }}
<td>
{{ $tdContent := $.Scratch.Get . }}
{{ if eq $k 3 }}
{{ printf "%v" $tdContent |
strings.ReplaceRE `\[` "<ol><li>" |
strings.ReplaceRE `\s` "</li><li>" |
strings.ReplaceRE `\]` "</li></ol>" |
safeHTML }}
{{ else }}
{{ $tdContent }}
{{ end}}
</td>
{{ end }}
</tr>
{{ end }}

View file

@ -3,7 +3,7 @@ publish = "public"
command = "hugo --gc --minify"
[context.production.environment]
HUGO_VERSION = "0.81.0"
HUGO_VERSION = "0.82.1"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
command = "hugo --gc --minify --enableGitInfo"
[context.split1.environment]
HUGO_VERSION = "0.81.0"
HUGO_VERSION = "0.82.1"
HUGO_ENV = "production"
[context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
[context.deploy-preview.environment]
HUGO_VERSION = "0.81.0"
HUGO_VERSION = "0.82.1"
[context.branch-deploy]
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
[context.branch-deploy.environment]
HUGO_VERSION = "0.81.0"
HUGO_VERSION = "0.82.1"
[context.next.environment]
HUGO_ENABLEGITINFO = "true"

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB