Merge commit '2e711a28c71e8667258e5ab824f9b9a71c261b0a'
|
@ -13,16 +13,16 @@ Note that this repository contains solely the documentation for Hugo. For contri
|
|||
|
||||
*Pull requests shall **only** contain changes to the actual documentation. However, changes on the code base of Hugo **and** the documentation shall be a single, atomic pull request in the [hugo](https://github.com/gohugoio/hugo) repository.*
|
||||
|
||||
Spelling fixes are most welcomed, and if you want to contribute longer sections to the documentation, it would be great if you had these in mind when writing:
|
||||
Spelling fixes are most welcomed, and if you want to contribute longer sections to the documentation, it would be great if you had the following criteria in mind when writing:
|
||||
|
||||
* Short is good. People go to the library to read novels. If there is more than one way to _do a thing_ in Hugo, describe the current _best practice_ (avoid "… but you can also do …" and "… in older versions of Hugo you had to …".
|
||||
* For examples, try to find short snippets that teaches people about the concept. If the example is also useful as-is (copy and paste), then great, but don't list long and similar examples just so people can use them on their sites.
|
||||
* Hugo has users from all over the world, so an easy to understand and [simple English](https://simple.wikipedia.org/wiki/Basic_English) is good.
|
||||
* For example, try to find short snippets that teaches people about the concept. If the example is also useful as-is (copy and paste), then great. Don't list long and similar examples just so people can use them on their sites.
|
||||
* Hugo has users from all over the world, so easy to understand and [simple English](https://simple.wikipedia.org/wiki/Basic_English) is good.
|
||||
|
||||
## Branches
|
||||
|
||||
* The `master` branch is where the site is automatically built from, and is the place to put changes relevant to the current Hugo version.
|
||||
* The `next` branch is where we store changes that is related to the next Hugo release. This can be previewed here: https://next--gohugoio.netlify.com/
|
||||
* The `next` branch is where we store changes that are related to the next Hugo release. This can be previewed here: https://next--gohugoio.netlify.com/
|
||||
|
||||
## Build
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ sections:
|
|||
link: templates/
|
||||
color_classes: bg-primary-color-light black
|
||||
image: /images/home-page-templating-example.png
|
||||
copy: "Hugo's Go-based templating provides just the right amount of logic to build anything from the simple to complex. If you prefer Jade/Pug-like syntax, you can also use Amber, Ace, or any combination of the three."
|
||||
copy: "Hugo's Go-based templating provides just the right amount of logic to build anything from the simple to complex."
|
||||
---
|
||||
|
||||
Hugo is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again.
|
||||
|
|
|
@ -98,11 +98,12 @@ Tags:
|
|||
{{ range $k, $v := .Tags }}
|
||||
TAG: {{ $k }}: {{ $v }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
#### Exif fields
|
||||
|
||||
Data
|
||||
Date
|
||||
: "photo taken" date/time
|
||||
|
||||
Lat
|
||||
|
|
|
@ -74,11 +74,9 @@ func GetTitleFunc(style string) func(s string) string {
|
|||
case "go":
|
||||
return strings.Title
|
||||
case "chicago":
|
||||
tc := transform.NewTitleConverter(transform.ChicagoStyle)
|
||||
return tc.Title
|
||||
return transform.NewTitleConverter(transform.ChicagoStyle)
|
||||
default:
|
||||
tc := transform.NewTitleConverter(transform.APStyle)
|
||||
return tc.Title
|
||||
return transform.NewTitleConverter(transform.APStyle)
|
||||
}
|
||||
}
|
||||
{{< / highlight >}}
|
||||
|
@ -93,14 +91,10 @@ See [Highlight](/functions/highlight/).
|
|||
|
||||
Highlighting in code fences is enabled by default.{{< new-in "0.60.0" >}}
|
||||
|
||||
````
|
||||
```go-html-template{hl_lines=[3,"5-6"],linenos=true}
|
||||
```
|
||||
````
|
||||
|
||||
````
|
||||
```go {linenos=table,hl_lines=[8,"15-17"],linenostart=199}
|
||||
// ... code
|
||||
```
|
||||
````
|
||||
|
||||
|
||||
|
@ -122,11 +116,9 @@ func GetTitleFunc(style string) func(s string) string {
|
|||
case "go":
|
||||
return strings.Title
|
||||
case "chicago":
|
||||
tc := transform.NewTitleConverter(transform.ChicagoStyle)
|
||||
return tc.Title
|
||||
return transform.NewTitleConverter(transform.ChicagoStyle)
|
||||
default:
|
||||
tc := transform.NewTitleConverter(transform.APStyle)
|
||||
return tc.Title
|
||||
return transform.NewTitleConverter(transform.APStyle)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
@ -18,7 +18,11 @@ toc: true
|
|||
---
|
||||
|
||||
{{% note "TOC Heading Levels are Fixed" %}}
|
||||
Currently, the `{{.TableOfContents}}` [page variable](/variables/page/) does not allow you to specify which heading levels you want the TOC to render. [See the related GitHub discussion (#1778)](https://github.com/gohugoio/hugo/issues/1778). As such, the resulting `<nav id="TableOfContents"><ul></ul></nav>` is going to start at `<h1>` when pulling from `{{.Content}}`.
|
||||
|
||||
Previously, there was no out-of-the-box way to specify which heading levels you want the TOC to render. [See the related GitHub discussion (#1778)](https://github.com/gohugoio/hugo/issues/1778). As such, the resulting `<nav id="TableOfContents"><ul></ul></nav>` was going to start at `<h1>` when pulling from `{{.Content}}`.
|
||||
|
||||
Hugo [v0.60.0](https://github.com/gohugoio/hugo/releases/tag/v0.60.0) made a switch to [Goldmark](https://github.com/yuin/goldmark/) as the default library for Markdown which has improved and configurable implementation of TOC. Take a look at [how to configure TOC](/getting-started/configuration-markup/#table-of-contents) for Goldmark renderer.
|
||||
|
||||
{{% /note %}}
|
||||
|
||||
## Usage
|
||||
|
@ -43,7 +47,7 @@ A collection of textile samples lay spread out on the table - Samsa was a travel
|
|||
|
||||
Hugo will take this Markdown and create a table of contents from `## Introduction`, `## My Heading`, and `### My Subheading` and then store it in the [page variable][pagevars]`.TableOfContents`.
|
||||
|
||||
The built-in `.TableOfContents` variables outputs a `<nav id="TableOfContents">` element with a child `<ul>`, whose child `<li>` elements begin with any `<h1>`'s (i.e., `#` in markdown) inside your content.'
|
||||
The built-in `.TableOfContents` variables outputs a `<nav id="TableOfContents">` element with a child `<ul>`, whose child `<li>` elements begin with appropriate HTML headings. See [the available settings](/getting-started/configuration-markup/#table-of-contents) to configure what heading levels you want to include in TOC.
|
||||
|
||||
{{% note "Table of contents not available for MMark" %}}
|
||||
Hugo documents created in the [MMark](/content-management/formats/#mmark) Markdown dialect do not currently display TOCs. TOCs are, however, compatible with all other supported Markdown formats.
|
||||
|
|
|
@ -17,7 +17,8 @@ aliases: [/overview/introduction/]
|
|||
toc: false
|
||||
---
|
||||
|
||||
If this is your first time using Hugo and you've [already installed Hugo on your machine][installed], we recommend the [quick start][].
|
||||
If this is your first time using Hugo and you've [already installed Hugo on your machine][installed], we recommend the [quick start][]. You can also use [external learning resources][] to learn Hugo.
|
||||
|
||||
[installed]: /getting-started/installing/
|
||||
[quick start]: /getting-started/quick-start/
|
||||
[external learning resources]: /getting-started/external-learning-resources/
|
||||
|
|
|
@ -350,9 +350,9 @@ To set config params, prefix the name with `HUGO_PARAMS_`
|
|||
Test and document setting params via JSON env var.
|
||||
{{< /todo >}}
|
||||
|
||||
## Ignore Files When Rendering
|
||||
## Ignore Content Files When Rendering
|
||||
|
||||
The following statement inside `./config.toml` will cause Hugo to ignore files ending with `.foo` and `.boo` when rendering:
|
||||
The following statement inside `./config.toml` will cause Hugo to ignore content files ending with `.foo` and `.boo` when rendering:
|
||||
|
||||
```
|
||||
ignoreFiles = [ "\\.foo$", "\\.boo$" ]
|
||||
|
|
After Width: | Height: | Size: 223 KiB |
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: External Learning Resources
|
||||
linktitle: External Learning Resources
|
||||
description: A list of tutorials and books on Hugo.
|
||||
date: 2019-10-20
|
||||
publishdate: 2019-10-20
|
||||
lastmod: 2019-10-20
|
||||
keywords: [books,tutorials,learning,usage]
|
||||
menu:
|
||||
docs:
|
||||
parent: "getting-started"
|
||||
weight: 70
|
||||
weight: 70
|
||||
sections_weight: 70
|
||||
draft: false
|
||||
toc: false
|
||||
---
|
||||
|
||||
## Books
|
||||
### Hugo In Action
|
||||
[![Hugo In Action](hia.jpg)](https://www.manning.com/books/hugo-in-action)
|
||||
|
||||
Hugo in Action is a step-by-step guide to using Hugo to create static websites. Working with a complete example website and source code samples, you’ll learn how to build and host a low-maintenance, high-performance site that will wow your users and stay stable without relying on a third-party server.
|
||||
|
||||
[Hugo In Action Home Page](https://www.manning.com/books/hugo-in-action)
|
||||
|
||||
## Video tutorials
|
||||
### Video Playlist by Mike Dane
|
||||
Mike Dane expains the various features of via dedicated tutorials on [Youtube](https://www.youtube.com/watch?list=PLLAZ4kZ9dFpOnyRlyS-liKL5ReHDcj4G3&v=qtIqKaDlqXo).
|
|
@ -463,6 +463,8 @@ Hugo installed via Snap can write only inside the user’s `$HOME` directory---a
|
|||
|
||||
This installs the "extended" Sass/SCSS version.
|
||||
|
||||
This option is not recommended because the Hugo in Linux package managers for Debian and Ubuntu is usually a few versions behind as described [here](https://github.com/gcushen/hugo-academic/issues/703)
|
||||
|
||||
### Arch Linux
|
||||
|
||||
You can also install Hugo from the Arch Linux [community](https://www.archlinux.org/packages/community/x86_64/hugo/) repository. Applies also to derivatives such as Manjaro.
|
||||
|
|
|
@ -21,7 +21,9 @@ toc: true
|
|||
{{% note %}}
|
||||
This quick start uses `macOS` in the examples. For instructions about how to install Hugo on other operating systems, see [install](/getting-started/installing).
|
||||
|
||||
It is recommended to have [Git](https://git-scm.com/downloads) installed to run this tutorial.
|
||||
It is recommended to have [Git installed](https://git-scm.com/downloads) to run this tutorial.
|
||||
|
||||
For other approaches learning Hugo like book or a video tutorial refer to the [external learning resources](/getting-started/external-learning-resources/) page.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
|
|
|
@ -90,14 +90,14 @@ cloudFrontDistributionID = <ID>
|
|||
# Samples:
|
||||
|
||||
[[deployment.matchers]]
|
||||
# Cache static assets for 20 years.
|
||||
# Cache static assets for 1 year.
|
||||
pattern = "^.+\\.(js|css|svg|ttf)$"
|
||||
cacheControl = "max-age=630720000, no-transform, public"
|
||||
cacheControl = "max-age=31536000, no-transform, public"
|
||||
gzip = true
|
||||
|
||||
[[deployment.matchers]]
|
||||
pattern = "^.+\\.(png|jpg)$"
|
||||
cacheControl = "max-age=630720000, no-transform, public"
|
||||
cacheControl = "max-age=31536000, no-transform, public"
|
||||
gzip = false
|
||||
|
||||
[[deployment.matchers]]
|
||||
|
|
|
@ -16,9 +16,9 @@ aliases: [/themes/usage/,/themes/installing/,/installing-and-using-themes/]
|
|||
toc: true
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
## Prerequisite
|
||||
|
||||
{{% gomodules-info %}}
|
||||
{{< gomodules-info >}}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
---
|
||||
date: 2019-11-27
|
||||
title: "0.60.0"
|
||||
description: "0.60.0"
|
||||
title: "Now CommonMark Compliant!"
|
||||
description: "Goldmark -- CommonMark compliant, GitHub flavored, fast and flexible -- is the new default library for Markdown in Hugo."
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
|
@ -10,6 +10,15 @@ categories: ["Releases"]
|
|||
|
||||
Please read the [Notes Section](#notes) and the updated documentation. We suggest you start with [List of content formats in Hugo](https://gohugo.io/content-management/formats/#list-of-content-formats). Goldmark is better, but the feature set is not fully comparable and it may be more stricter in some areas (there are 17 rules for how a [headline](https://spec.commonmark.org/0.29/#emphasis-and-strong-emphasis) should look like); if you have any problems you cannot work around, see [Configure Markup](https://gohugo.io/getting-started/configuration-markup/#configure-markup) for a way to change the default Markdown handler.
|
||||
|
||||
Also, if you have lots of inline HTML in your Markdown files, you may have to enable the `unsafe` mode:
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
markup:
|
||||
goldmark:
|
||||
renderer:
|
||||
unsafe: true
|
||||
{{< /code-toggle >}}
|
||||
|
||||
This release represents **62 contributions by 10 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 [@anthonyfok](https://github.com/anthonyfok), [@max-arnold](https://github.com/max-arnold), and [@trimbo](https://github.com/trimbo) for their ongoing contributions.
|
||||
And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) and [@onedrawingperday](https://github.com/onedrawingperday) for their relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) and [@davidsneighbour](https://github.com/davidsneighbour) for great work on the documentation site.
|
||||
|
||||
|
|
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 28 KiB |
|
@ -4,9 +4,6 @@ date: 2019-11-29
|
|||
title: "Hugo 0.60.1: A couple of Bug Fixes"
|
||||
description: "This version fixes a couple of bugs introduced in 0.60.0."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
|
After Width: | Height: | Size: 78 KiB |
|
@ -1,8 +1,8 @@
|
|||
|
||||
---
|
||||
date: 2019-12-11
|
||||
title: "0.61.0"
|
||||
description: "0.61.0"
|
||||
title: "40K GitHub Stars Edition"
|
||||
description: "40K stars on GitHub is a good enough reason to release a new version of Hugo!"
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@ The following is only a primer on Go Templates. For an in-depth look into Go Tem
|
|||
|
||||
Go Templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer.
|
||||
|
||||
{{< youtube gnJbPO-GFIw >}}
|
||||
|
||||
## Basic Syntax
|
||||
|
||||
Go Templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go Template variables and functions are accessible within `{{ }}`.
|
||||
|
|
|
@ -4,7 +4,7 @@ linktitle: Custom Output Formats
|
|||
description: Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format.
|
||||
date: 2017-03-22
|
||||
publishdate: 2017-03-22
|
||||
lastmod: 2017-03-22
|
||||
lastmod: 2019-12-11
|
||||
categories: [templates]
|
||||
keywords: ["amp","outputs","rss"]
|
||||
menu:
|
||||
|
@ -31,7 +31,7 @@ This is the full set of built-in media types in Hugo:
|
|||
**Note:**
|
||||
|
||||
* It is possible to add custom media types or change the defaults; e.g., if you want to change the suffix for `text/html` to `asp`.
|
||||
* The `Suffix` is the value that will be used for URLs and filenames for that media type in Hugo.
|
||||
* `Suffixes` are the values that will be used for URLs and filenames for that media type in Hugo.
|
||||
* The `Type` is the identifier that must be used when defining new/custom `Output Formats` (see below).
|
||||
* The full set of media types will be registered in Hugo's built-in development server to make sure they are recognized by the browser.
|
||||
|
||||
|
@ -40,9 +40,9 @@ To add or modify a media type, define it in a `mediaTypes` section in your [site
|
|||
{{< code-toggle file="config" >}}
|
||||
[mediaTypes]
|
||||
[mediaTypes."text/enriched"]
|
||||
suffix = "enr"
|
||||
suffixes = ["enr"]
|
||||
[mediaTypes."text/html"]
|
||||
suffix = "asp"
|
||||
suffixes = ["asp"]
|
||||
{{</ code-toggle >}}
|
||||
|
||||
The above example adds one new media type, `text/enriched`, and changes the suffix for the built-in `text/html` media type.
|
||||
|
@ -52,7 +52,7 @@ The above example adds one new media type, `text/enriched`, and changes the suff
|
|||
```toml
|
||||
[mediaTypes]
|
||||
[mediaTypes."text/html"]
|
||||
suffix = "htm"
|
||||
suffixes = ["htm"]
|
||||
|
||||
# Redefine HTML to update its media type.
|
||||
[outputFormats]
|
||||
|
@ -221,7 +221,7 @@ From content files, you can use the [`ref` or `relref` shortcodes](/content-mana
|
|||
A new output format needs a corresponding template in order to render anything useful.
|
||||
|
||||
{{% note %}}
|
||||
The key distinction for Hugo versions 0.20 and newer is that Hugo looks at an output format's `Name` and MediaType's `Suffix` when choosing the template used to render a given `Page`.
|
||||
The key distinction for Hugo versions 0.20 and newer is that Hugo looks at an output format's `Name` and MediaType's `Suffixes` when choosing the template used to render a given `Page`.
|
||||
{{% /note %}}
|
||||
|
||||
The following table shows examples of different output formats, the suffix used, and Hugo's respective template [lookup order][]. All of the examples in the table can:
|
||||
|
|
|
@ -18,7 +18,7 @@ aliases: []
|
|||
toc: true
|
||||
---
|
||||
|
||||
A static website with a dynamic search function? Yes. As alternatives to embeddable scripts from Google or other search engines, you can provide your visitors a custom search by indexing your content files directly.
|
||||
A static website with a dynamic search function? Yes, Hugo provides an alternative to embeddable scripts from Google or other search engines for static websites. Hugo allows you to provide your visitors with a custom search function by indexing your content files directly.
|
||||
|
||||
* [GitHub Gist for Hugo Workflow](https://gist.github.com/sebz/efddfc8fdcb6b480f567). This gist contains a simple workflow to create a search index for your static website. It uses a simple Grunt script to index all your content files and [lunr.js](https://lunrjs.com/) to serve the search results.
|
||||
* [hugo-elasticsearch](https://www.npmjs.com/package/hugo-elasticsearch). Generate [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html) indexes for Hugo static sites by parsing front matter. Hugo-Elasticsearch will generate a newline delimited JSON (NDJSON) file that can be bulk uploaded into Elasticsearch using any one of the available [clients](https://www.elastic.co/guide/en/elasticsearch/client/index.html).
|
||||
|
|
|
@ -1387,8 +1387,7 @@
|
|||
},
|
||||
"tableOfContents": {
|
||||
"startLevel": 2,
|
||||
"endLevel": 3,
|
||||
"ordered": false
|
||||
"endLevel": 3
|
||||
},
|
||||
"goldmark": {
|
||||
"renderer": {
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
[[tweet]]
|
||||
name = "Heinrich Hartmann"
|
||||
twitter_handle = "@heinrichhartman"
|
||||
quote = "Working with @GoHugoIO is such a joy. Having worked with #Jekyll in the past, the near instant preview is a big win! Did not expect this to make such a huge difference."
|
||||
link = "https://twitter.com/heinrichhartman/status/1199736512264462341"
|
||||
date = 2019-11-12T00:00:00Z
|
||||
|
||||
[[tweet]]
|
||||
name = "Joshua Steven"
|
||||
twitter_handle = "@jscarto"
|
||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
|||
command = "hugo --gc --minify"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.59.1"
|
||||
HUGO_VERSION = "0.61.0"
|
||||
HUGO_ENV = "production"
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
||||
|
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
|||
command = "hugo --gc --minify --enableGitInfo"
|
||||
|
||||
[context.split1.environment]
|
||||
HUGO_VERSION = "0.59.1"
|
||||
HUGO_VERSION = "0.61.0"
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.59.1"
|
||||
HUGO_VERSION = "0.61.0"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_VERSION = "0.59.1"
|
||||
HUGO_VERSION = "0.61.0"
|
||||
|
||||
[context.next.environment]
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
|
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 52 KiB |