mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-28 22:21:46 -05:00
Merge commit 'b239595af5a9fc1fc9a1ccc666c3ab06ccc32f04'
This commit is contained in:
commit
e02629f81a
21 changed files with 41 additions and 35 deletions
|
@ -1,6 +1,6 @@
|
|||
# Hugo Docs
|
||||
|
||||
Documentation site for [Hugo](https://github.com/gohugoio/hugo), the very fast and flexible static site generator built with love in GoLang.
|
||||
Documentation site for [Hugo](https://github.com/gohugoio/hugo), the very fast and flexible static site generator built with love in Go.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ toc: true
|
|||
|
||||
**Hugo is a static site generator. By using Hugo you are already standing on very solid ground. Static HTML files on disk are much easier to reason about compared to server and database driven web sites.**
|
||||
|
||||
But even static websites can integrate with external services, so from version `0.41`, Hugo provides a `Privacy Config` that covers the relevant built-in templates.
|
||||
But even static websites can integrate with external services, so from version `0.41`, Hugo provides a **Privacy Config** that covers the relevant built-in templates.
|
||||
|
||||
Note that:
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ i18n|MISSING_TRANSLATION|en|wordCount
|
|||
|
||||
## Customize Dates
|
||||
|
||||
At the time of this writing, Golang does not yet have support for internationalized locales, but if you do some work, you can simulate it. For example, if you want to use French month names, you can add a data file like ``data/mois.yaml`` with this content:
|
||||
At the time of this writing, Go does not yet have support for internationalized locales, but if you do some work, you can simulate it. For example, if you want to use French month names, you can add a data file like ``data/mois.yaml`` with this content:
|
||||
|
||||
~~~yaml
|
||||
1: "janvier"
|
||||
|
|
|
@ -88,7 +88,7 @@ Luckily, redirects can be handled easily with **aliases** in Hugo.
|
|||
|
||||
### Example: Aliases
|
||||
|
||||
Let's assume you create a new piece of content at `content/posts/my-awesome-blog-post.md`. The content is a revision of your previous post at `content/posts/my-original-url.md`. You can create an `aliases` field in the front matter of your new `my-awesome-blog-post.md` where you can add previous paths. The following examples show how to create this filed in TOML and YAML front matter, respectively.
|
||||
Let's assume you create a new piece of content at `content/posts/my-awesome-blog-post.md`. The content is a revision of your previous post at `content/posts/my-original-url.md`. You can create an `aliases` field in the front matter of your new `my-awesome-blog-post.md` where you can add previous paths. The following examples show how to create this field in TOML and YAML front matter, respectively.
|
||||
|
||||
#### TOML Front Matter
|
||||
|
||||
|
@ -188,7 +188,7 @@ content/posts/post-1.md
|
|||
|
||||
## Ugly URLs
|
||||
|
||||
If you would like to have what are often referred to as "ugly URLs" (e.g., example.com/urls.html), set `uglyurls = true` or `uglyurls: true` in your site's `config.toml` or `config.yaml`, respectively. You can also use the `--uglyURLs=true` [flag from the command line][usage] with `hugo` or `hugo server`..
|
||||
If you would like to have what are often referred to as "ugly URLs" (e.g., example.com/urls.html), set `uglyurls = true` or `uglyurls: true` in your site's `config.toml` or `config.yaml`, respectively. You can also use the `--uglyURLs=true` [flag from the command line][usage] with `hugo` or `hugo server`.
|
||||
|
||||
If you want a specific piece of content to have an exact URL, you can specify this in the [front matter][] under the `url` key. The following are examples of the same content directory and what the eventual URL structure will be when Hugo runs with its default behavior.
|
||||
|
||||
|
@ -253,7 +253,7 @@ Or, if you are on Windows and do not have `grep` installed:
|
|||
hugo config | FINDSTR /I canon
|
||||
```
|
||||
|
||||
## Override URLS with Front Matter
|
||||
## Override URLs with Front Matter
|
||||
|
||||
In addition to specifying permalink values in your site configuration for different content sections, Hugo provides even more granular control for individual pieces of content.
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ If you are having trouble following the installation guides for Go, check out [G
|
|||
|
||||
### Install Go From Source
|
||||
|
||||
[Download the latest stable version of Go][godl] and follow the official [Golang installation guide][goinstall].
|
||||
[Download the latest stable version of Go][godl] and follow the official [Go installation guide][goinstall].
|
||||
|
||||
Once you're finished installing Go, let's confirm everything is working correctly. Open a terminal---or command line under Windows--and type the following:
|
||||
|
||||
|
@ -390,7 +390,7 @@ Thank you for reading through this contribution guide. Hopefully, we will see yo
|
|||
|
||||
Feel free to [open an issue][newissue] if you think you found a bug or you have a new idea to improve Hugo. We are happy to hear from you.
|
||||
|
||||
## Additional References for Learning Git and Golang
|
||||
## Additional References for Learning Git and Go
|
||||
|
||||
* [Codecademy's Free "Learn Git" Course][codecademy] (Free)
|
||||
* [Code School and GitHub's "Try Git" Tutorial][trygit] (Free)
|
||||
|
|
|
@ -35,9 +35,9 @@ You can limit the number of matches in the list with a third parameter. The foll
|
|||
```
|
||||
|
||||
{{% note %}}
|
||||
Hugo uses Golang's [Regular Expression package](https://golang.org/pkg/regexp/), which is the same general syntax used by Perl, Python, and other languages but with a few minor differences for those coming from a background in PCRE. For a full syntax listing, see the [GitHub wiki for re2](https://github.com/google/re2/wiki/Syntax).
|
||||
Hugo uses Go's [Regular Expression package](https://golang.org/pkg/regexp/), which is the same general syntax used by Perl, Python, and other languages but with a few minor differences for those coming from a background in PCRE. For a full syntax listing, see the [GitHub wiki for re2](https://github.com/google/re2/wiki/Syntax).
|
||||
|
||||
If you are just learning RegEx, or at least Golang's flavor, you can practice pattern matching in the browser at <https://regex101.com/>.
|
||||
If you are just learning RegEx, or at least Go's flavor, you can practice pattern matching in the browser at <https://regex101.com/>.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ Assuming a key-value of `date: 2017-03-03` in a content file's front matter, you
|
|||
{{ .PublishDate.Format "January 2, 2006" }} => March 3, 2017
|
||||
```
|
||||
|
||||
For formatting *any* string representations of dates defined in your front matter, see the [`dateFormat` function][dateFormat], which will still leverage the Golang layout string explained below but uses a slightly different syntax.
|
||||
For formatting *any* string representations of dates defined in your front matter, see the [`dateFormat` function][dateFormat], which will still leverage the Go layout string explained below but uses a slightly different syntax.
|
||||
|
||||
## Go's Layout String
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ toc: false
|
|||
aliases: []
|
||||
---
|
||||
|
||||
`len` is a built-in function in Golang that returns the length of a variable according to its type. From the Golang documentation:
|
||||
`len` is a built-in function in Go that returns the length of a variable according to its type. From the Go documentation:
|
||||
|
||||
> Array: the number of elements in v.
|
||||
>
|
||||
|
|
|
@ -37,7 +37,7 @@ would produce the following:
|
|||
</div>
|
||||
```
|
||||
|
||||
The above example uses the [`.Format` function](/functions/format), which page includes a full listing of date formatting using Golang's layout string.
|
||||
The above example uses the [`.Format` function](/functions/format), which page includes a full listing of date formatting using Go's layout string.
|
||||
|
||||
{{% note %}}
|
||||
Older Hugo themes may still be using the obsolete Page’s `.Now` (uppercase with leading dot), which causes build error that looks like the following:
|
||||
|
|
|
@ -25,7 +25,7 @@ aliases: []
|
|||
```
|
||||
|
||||
{{% note %}}
|
||||
Hugo uses Golang's [Regular Expression package](https://golang.org/pkg/regexp/), which is the same general syntax used by Perl, Python, and other languages but with a few minor differences for those coming from a background in PCRE. For a full syntax listing, see the [GitHub wiki for re2](https://github.com/google/re2/wiki/Syntax).
|
||||
Hugo uses Go's [Regular Expression package](https://golang.org/pkg/regexp/), which is the same general syntax used by Perl, Python, and other languages but with a few minor differences for those coming from a background in PCRE. For a full syntax listing, see the [GitHub wiki for re2](https://github.com/google/re2/wiki/Syntax).
|
||||
|
||||
If you are just learning RegEx, or at least Golang's flavor, you can practice pattern matching in the browser at <https://regex101.com/>.
|
||||
If you are just learning RegEx, or at least Go's flavor, you can practice pattern matching in the browser at <https://regex101.com/>.
|
||||
{{% /note %}}
|
||||
|
|
|
@ -210,6 +210,9 @@ theme ("")
|
|||
themesDir ("themes")
|
||||
: The directory where Hugo reads the themes from.
|
||||
|
||||
timeout (10000)
|
||||
: Timeout for generating page contents, in milliseconds (defaults to 10 seconds). *Note:* this is used to bail out of recursive content generation, if your pages are slow to generate (e.g., because they require large image processing or depend on remote contents) you might need to raise this limit.
|
||||
|
||||
title ("")
|
||||
: Site title.
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ If you're already using Nanobox and just need deployment instructions, you can s
|
|||
|
||||
## What You'll Need
|
||||
|
||||
With Nanobox you don't need to worry about having Golang or Hugo installed. They'll be installed as part of the development environment created for you.
|
||||
With Nanobox you don't need to worry about having Go or Hugo installed. They'll be installed as part of the development environment created for you.
|
||||
|
||||
To get started you'll just need the following three items:
|
||||
|
||||
|
@ -133,7 +133,7 @@ Make sure to check the version of Hugo you have installed and update the install
|
|||
|
||||
### Generating a New Hugo App
|
||||
|
||||
You'll generate your new application from inside the Nanobox VM (this is why you don't need to worry about having Golang or Hugo installed).
|
||||
You'll generate your new application from inside the Nanobox VM (this is why you don't need to worry about having Go or Hugo installed).
|
||||
|
||||
Run the following command to drop into a Nanobox console (inside the VM) where your codebase is mounted:
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ The following examples use GitHub, but other git providers will follow a similar
|
|||
|
||||
![Screenshot of the homepage for app.netlify.com, containing links to the most popular hosted git solutions.](/images/hosting-and-deployment/hosting-on-netlify/netlify-signup.jpg)
|
||||
|
||||
Selecting GitHub will bring up a typical modal you've seen through other application that use GitHub for authentication. Select "Authorize application."
|
||||
Selecting GitHub will bring up an authorization modal for authentication. Select "Authorize application."
|
||||
|
||||
![Screenshot of the authorization popup for Netlify and GitHub.](/images/hosting-and-deployment/hosting-on-netlify/netlify-first-authorize.jpg)
|
||||
|
||||
|
|
BIN
docs/content/en/news/0.41-relnotes/featured-hugo-41-poster.png
Normal file
BIN
docs/content/en/news/0.41-relnotes/featured-hugo-41-poster.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
|
@ -1,13 +1,13 @@
|
|||
|
||||
---
|
||||
date: 2018-05-25
|
||||
title: "0.41"
|
||||
description: "0.41"
|
||||
title: "Hugo 0.41: Privacy Configuration for GDPR"
|
||||
description: "Hugo 0.41 adds a new site configuration section to meet the new General Data Protection Regulation (GDPR)."
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
|
||||
In Hugo `0.41` we add a new **Privacy Configuration** section to meet the new regulations in the new **General Data Protection Regulation ([GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation))**. Many have contributed in the discussion about this, but a special thanks to [@onedrawingperday](https://github.com/onedrawingperday), [@jhabdas](https://github.com/jhabdas), and [@it-gro](https://github.com/it-gro).
|
||||
In Hugo `0.41` we add a new **Privacy Configuration** section to meet the new regulations in the new **General Data Protection Regulation ([GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation))**. Many have contributed work on this project, but a special thanks to [@onedrawingperday](https://github.com/onedrawingperday), [@jhabdas](https://github.com/jhabdas), and [@it-gro](https://github.com/it-gro).
|
||||
|
||||
> You can read more about the new Privacy Config [here](https://gohugo.io/about/hugo-and-gdpr/).
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ Go templates provide an extremely simple template language that adheres to the b
|
|||
|
||||
## Basic Syntax
|
||||
|
||||
Golang templates are HTML files with the addition of [variables][variables] and [functions][functions]. Golang template variables and functions are accessible within `{{ }}`.
|
||||
Go templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go template variables and functions are accessible within `{{ }}`.
|
||||
|
||||
### Access a Predefined Variable
|
||||
|
||||
|
@ -104,7 +104,7 @@ Go templates only ship with a few basic functions but also provide a mechanism f
|
|||
Note that both examples make use of Go template's [math functions][].
|
||||
|
||||
{{% note "Additional Boolean Operators" %}}
|
||||
There are more boolean operators than those listed in the Hugo docs in the [Golang template documentation](http://golang.org/pkg/text/template/#hdr-Functions).
|
||||
There are more boolean operators than those listed in the Hugo docs in the [Go template documentation](http://golang.org/pkg/text/template/#hdr-Functions).
|
||||
{{% /note %}}
|
||||
|
||||
## Includes
|
||||
|
@ -526,8 +526,8 @@ Go allows you to do more than what's shown here. Using Hugo's [`where` function]
|
|||
[first]: /functions/first/
|
||||
[front matter]: /content-management/front-matter/
|
||||
[functions]: /functions/ "See the full list of Hugo's templating functions with a quick start reference guide and basic and advanced examples."
|
||||
[Go html/template]: http://golang.org/pkg/html/template/ "Godocs references for Golang's html templating"
|
||||
[gohtmltemplate]: http://golang.org/pkg/html/template/ "Godocs references for Golang's html templating"
|
||||
[Go html/template]: http://golang.org/pkg/html/template/ "Godocs references for Go's html templating"
|
||||
[gohtmltemplate]: http://golang.org/pkg/html/template/ "Godocs references for Go's html templating"
|
||||
[index]: /functions/index/
|
||||
[math functions]: /functions/math/
|
||||
[partials]: /templates/partials/ "Link to the partial templates page inside of the templating section of the Hugo docs"
|
||||
|
|
|
@ -77,12 +77,12 @@ Using the above example, let's assume you have the following in `content/post/_i
|
|||
|
||||
{{< code file="content/post/_index.md" >}}
|
||||
---
|
||||
title: My Golang Journey
|
||||
title: My Go Journey
|
||||
date: 2017-03-23
|
||||
publishdate: 2017-03-24
|
||||
---
|
||||
|
||||
I decided to start learning Golang in March 2017.
|
||||
I decided to start learning Go in March 2017.
|
||||
|
||||
Follow my journey through this new blog.
|
||||
{{< /code >}}
|
||||
|
@ -118,9 +118,9 @@ This above will output the following HTML:
|
|||
<main>
|
||||
<article>
|
||||
<header>
|
||||
<h1>My Golang Journey</h1>
|
||||
<h1>My Go Journey</h1>
|
||||
</header>
|
||||
<p>I decided to start learning Golang in March 2017.</p>
|
||||
<p>I decided to start learning Go in March 2017.</p>
|
||||
<p>Follow my journey through this new blog.</p>
|
||||
</article>
|
||||
<ul>
|
||||
|
@ -457,7 +457,7 @@ In the above example, you may want `{{.Title}}` to point the `title` field you h
|
|||
|
||||
### By Page Parameter in Date Format
|
||||
|
||||
The following template takes grouping by `date` a step further and uses Golang's layout string. See the [`Format` function][] for more examples of how to use Golang's layout string to format dates in Hugo.
|
||||
The following template takes grouping by `date` a step further and uses Go's layout string. See the [`Format` function][] for more examples of how to use Go's layout string to format dates in Hugo.
|
||||
|
||||
{{< code file="layouts/partials/by-page-param-as-date.html" >}}
|
||||
<!-- Groups content by month according to the "param_key" field in front matter -->
|
||||
|
|
|
@ -20,6 +20,9 @@ toc: false
|
|||
|
||||
[Shortcodes][shortcodes] have access to parameters delimited in the shortcode declaration via [`.Get`][getfunction], page- and site-level variables, and also the following shortcode-specific fields:
|
||||
|
||||
.Ordinal
|
||||
: Zero-based ordinal in relation to its parent. If the parent is the page itself, this ordinal will represent the position of this shortcode in the page content.
|
||||
|
||||
.Parent
|
||||
: provides access to the parent shortcode context in nested shortcodes. This can be very useful for inheritance of common shortcode parameters from the root.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
|||
command = "hugo"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.40.3"
|
||||
HUGO_VERSION = "0.41"
|
||||
HUGO_ENV = "production"
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
||||
|
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
|||
command = "hugo --enableGitInfo"
|
||||
|
||||
[context.split1.environment]
|
||||
HUGO_VERSION = "0.40.3"
|
||||
HUGO_VERSION = "0.41"
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "hugo -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.40.3"
|
||||
HUGO_VERSION = "0.41"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "hugo -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_VERSION = "0.40.3"
|
||||
HUGO_VERSION = "0.41"
|
||||
|
||||
[context.next.environment]
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
Loading…
Reference in a new issue