Merge commit '74309fe5699a595080fdb3a14711e0869babce99'

This commit is contained in:
Bjørn Erik Pedersen 2018-10-29 09:23:25 +01:00
commit 4b2738d871
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
59 changed files with 306 additions and 127 deletions

View file

@ -0,0 +1,8 @@
Add some **general info** about {{ replace .Name "-" " " | title }} here.
The site is built by:
* [Person 1](https://example.com)
* [Person 1](https://example.com)

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View file

@ -0,0 +1,37 @@
---
title: {{ replace .Name "-" " " | title }}
date: {{ now.Format "2006-01-02" }}
description: "A short description of this page."
# The URL to the site on the internet.
siteURL: https://gohugo.io/
# Link to the site's Hugo source code if public and you can/want to share.
# Remove or leave blank if not needed/wanted.
siteSource: https://github.com/gohugoio/hugoDocs
# Add credit to the article author. Leave blank or remove if not needed/wanted.
byline: "[bep](https://github.com/bep), Hugo Lead"
---
To complete this showcase:
1. Write the story about your site in this file.
2. Add a summary to the `bio.md` file in this folder.
3. Replace the `featured-template.png` with a screenshot of your site. You can rename it, but it must contain the word `featured`.
4. Create a new pull request in https://github.com/gohugoio/hugoDocs/pulls
The content of this bundle explained:
index.md
: The main content file. Fill in required front matter metadata and write your story. I does not have to be a novel. It can even be self-promotional, but it should include Hugo in some form.
bio.md
: A short summary of the website. Site credits (who built it) fits nicely here.
featured.png
: A reasonably sized screenshot of your website. It can be named anything, but the name must start with "featured". The sample image is `1500x750` (2:1 aspect ratio).

View file

@ -107,7 +107,7 @@ twitter = "GoHugoIO"
# Note that you can also set this per image processing.
resampleFilter = "CatmullRom"
# Defatult JPEG quality setting. Default is 75.
# Default JPEG quality setting. Default is 75.
quality = 75
anchor = "smart"

View file

@ -199,7 +199,7 @@ You can configure an `imaging` section in `config.toml` with default image proce
# See https://github.com/disintegration/imaging
resampleFilter = "box"
# Defatult JPEG quality setting. Default is 75.
# Default JPEG quality setting. Default is 75.
quality = 68
```

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo"
slug: hugo
url: /commands/hugo/
@ -74,4 +74,4 @@ hugo [flags]
* [hugo server](/commands/hugo_server/) - A high performance webserver
* [hugo version](/commands/hugo_version/) - Print the version number of Hugo
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo benchmark"
slug: hugo_benchmark
url: /commands/hugo_benchmark/
@ -66,4 +66,4 @@ hugo benchmark [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo check"
slug: hugo_check
url: /commands/hugo_check/
@ -35,4 +35,4 @@ Contains some verification checks
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo check ulimit](/commands/hugo_check_ulimit/) - Check system ulimit settings
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo check ulimit"
slug: hugo_check_ulimit
url: /commands/hugo_check_ulimit/
@ -39,4 +39,4 @@ hugo check ulimit [flags]
* [hugo check](/commands/hugo_check/) - Contains some verification checks
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo config"
slug: hugo_config
url: /commands/hugo_config/
@ -39,4 +39,4 @@ hugo config [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo convert"
slug: hugo_convert
url: /commands/hugo_convert/
@ -42,4 +42,4 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.
* [hugo convert toTOML](/commands/hugo_convert_totoml/) - Convert front matter to TOML
* [hugo convert toYAML](/commands/hugo_convert_toyaml/) - Convert front matter to YAML
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo convert toJSON"
slug: hugo_convert_toJSON
url: /commands/hugo_convert_tojson/
@ -42,4 +42,4 @@ hugo convert toJSON [flags]
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo convert toTOML"
slug: hugo_convert_toTOML
url: /commands/hugo_convert_totoml/
@ -42,4 +42,4 @@ hugo convert toTOML [flags]
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo convert toYAML"
slug: hugo_convert_toYAML
url: /commands/hugo_convert_toyaml/
@ -42,4 +42,4 @@ hugo convert toYAML [flags]
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo env"
slug: hugo_env
url: /commands/hugo_env/
@ -38,4 +38,4 @@ hugo env [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo gen"
slug: hugo_gen
url: /commands/hugo_gen/
@ -38,4 +38,4 @@ A collection of several useful generators.
* [hugo gen doc](/commands/hugo_gen_doc/) - Generate Markdown documentation for the Hugo CLI.
* [hugo gen man](/commands/hugo_gen_man/) - Generate man pages for the Hugo CLI
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo gen autocomplete"
slug: hugo_gen_autocomplete
url: /commands/hugo_gen_autocomplete/
@ -56,4 +56,4 @@ hugo gen autocomplete [flags]
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo gen chromastyles"
slug: hugo_gen_chromastyles
url: /commands/hugo_gen_chromastyles/
@ -43,4 +43,4 @@ hugo gen chromastyles [flags]
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo gen doc"
slug: hugo_gen_doc
url: /commands/hugo_gen_doc/
@ -45,4 +45,4 @@ hugo gen doc [flags]
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo gen man"
slug: hugo_gen_man
url: /commands/hugo_gen_man/
@ -41,4 +41,4 @@ hugo gen man [flags]
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo import"
slug: hugo_import
url: /commands/hugo_import/
@ -37,4 +37,4 @@ Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_p
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo import jekyll](/commands/hugo_import_jekyll/) - hugo import from Jekyll
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo import jekyll"
slug: hugo_import_jekyll
url: /commands/hugo_import_jekyll/
@ -41,4 +41,4 @@ hugo import jekyll [flags]
* [hugo import](/commands/hugo_import/) - Import your site from others.
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo list"
slug: hugo_list
url: /commands/hugo_list/
@ -40,4 +40,4 @@ List requires a subcommand, e.g. `hugo list drafts`.
* [hugo list expired](/commands/hugo_list_expired/) - List all posts already expired
* [hugo list future](/commands/hugo_list_future/) - List all posts dated in the future
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo list drafts"
slug: hugo_list_drafts
url: /commands/hugo_list_drafts/
@ -39,4 +39,4 @@ hugo list drafts [flags]
* [hugo list](/commands/hugo_list/) - Listing out various types of content
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo list expired"
slug: hugo_list_expired
url: /commands/hugo_list_expired/
@ -40,4 +40,4 @@ hugo list expired [flags]
* [hugo list](/commands/hugo_list/) - Listing out various types of content
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo list future"
slug: hugo_list_future
url: /commands/hugo_list_future/
@ -40,4 +40,4 @@ hugo list future [flags]
* [hugo list](/commands/hugo_list/) - Listing out various types of content
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo new"
slug: hugo_new
url: /commands/hugo_new/
@ -17,8 +17,6 @@ You can also specify the kind with `-k KIND`.
If archetypes are provided in your theme or site, they will be used.
Ensure you run this within the root directory of your site.
```
hugo new [path] [flags]
```
@ -50,4 +48,4 @@ hugo new [path] [flags]
* [hugo new site](/commands/hugo_new_site/) - Create a new site (skeleton)
* [hugo new theme](/commands/hugo_new_theme/) - Create a new theme
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo new site"
slug: hugo_new_site
url: /commands/hugo_new_site/
@ -43,4 +43,4 @@ hugo new site [path] [flags]
* [hugo new](/commands/hugo_new/) - Create new content for your site
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo new theme"
slug: hugo_new_theme
url: /commands/hugo_new_theme/
@ -42,4 +42,4 @@ hugo new theme [name] [flags]
* [hugo new](/commands/hugo_new/) - Create new content for your site
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo server"
slug: hugo_server
url: /commands/hugo_server/
@ -40,7 +40,6 @@ hugo server [flags]
--cleanDestinationDir remove files from destination not found in static directories
-c, --contentDir string filesystem path to content directory
-d, --destination string filesystem path to write files to
--disableBrowserError do not show build errors in the browser
--disableFastRender enables full re-renders on changes
--disableKinds strings disable different kind of pages (home, RSS etc.)
--disableLiveReload watch without enabling live browser reload on rebuild
@ -85,4 +84,4 @@ hugo server [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-10-26
date: 2018-09-24
title: "hugo version"
slug: hugo_version
url: /commands/hugo_version/
@ -38,4 +38,4 @@ hugo version [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 26-Oct-2018
###### Auto generated by spf13/cobra on 24-Sep-2018

View file

@ -42,7 +42,7 @@ You will get an error if you document could not be uniquely resolved. The error
Link to another language version of a document, you need to use this syntax:
```go-html-template
{{</* relref path="document.md" lang="jp" */>}}
{{</* relref path="document.md" lang="ja" */>}}
```
### Get another Output Format

View file

@ -1,7 +1,7 @@
---
title: Supported Content Formats
linktitle: Supported Content Formats
description: Markdown and Emacs Org-Mode have native support, and additional formats (e.g. Asciidoc) come via external helpers.
description: Both HTML and Markdown are supported content formats.
date: 2017-01-10
publishdate: 2017-01-10
lastmod: 2017-04-06
@ -19,7 +19,19 @@ toc: true
**Markdown is the main content format** and comes in two flavours: The excellent [Blackfriday project][blackfriday] (name your files `*.md` or set `markup = "markdown"` in front matter) or its fork [Mmark][mmark] (name your files `*.mmark` or set `markup = "mmark"` in front matter), both very fast markdown engines written in Go.
For Emacs users, [goorgeous](https://github.com/chaseadamsio/goorgeous) provides built-in native support for Org-mode (name your files `*.org` or set `markup = "org"` in front matter)
For Emacs users, [goorgeous](https://github.com/chaseadamsio/goorgeous) provides built-in native support for Org-mode (name your files `*.org` or set `markup = "org"` in front matter)
But in many situations, plain HTML is what you want. Just name your files with `.html` or `.htm` extension inside your content folder. Note that if you want your HTML files to have a layout, they need front matter. It can be empty, but it has to be there:
```html
---
title: "This is a content file in HTML"
---
<div>
<h1>Hello, Hugo!</h1>
</div>
```
{{% note "Deeply Nested Lists" %}}
Before you begin writing your content in markdown, Blackfriday has a known issue [(#329)](https://github.com/russross/blackfriday/issues/329) with handling deeply nested lists. Luckily, there is an easy workaround. Use 4-spaces (i.e., <kbd>tab</kbd>) rather than 2-space indentations.

View file

@ -59,6 +59,9 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables]
aliases
: an array of one or more aliases (e.g., old published paths of renamed content) that will be created in the output directory structure . See [Aliases][aliases] for details.
audio
: an array of paths to audio files related to the page; used by the `opengraph` [internal template](/templates/internal) to populate `og:audio`.
date
: the datetime at which the content was created; note this value is auto-populated according to Hugo's built-in [archetype][].
@ -74,6 +77,9 @@ expiryDate
headless
: if `true`, sets a leaf bundle to be [headless][headless-bundle].
images
: an array of paths to images related to the page; used by [internal templates](/templates/internal) such as `_internal/twitter_cards.html`.
isCJKLanguage
: if `true`, Hugo will explicitly treat the content as a CJK language; both `.Summary` and `.WordCount` work properly in CJK languages.
@ -101,6 +107,9 @@ publishDate
resources
: used for configuring page bundle resources. See [Page Resources][page-resources].
series
: an array of series this page belongs to, as a subset of the `series` [taxonomy](/content-management/taxonomies/); used by the `opengraph` [internal template](/templates/internal) to populate `og:see_also`.
slug
: appears as the tail of the output URL. A value specified in front matter will override the segment of the URL based on the filename.
@ -114,6 +123,9 @@ url
: the full path to the content from the web root. It makes no assumptions about the path of the content file. It also ignores any language prefixes of
the multilingual feature.
videos
: an array of paths to videos related to the page; used by the `opengraph` [internal template](/templates/internal) to populate `og:video`.
weight
: used for [ordering your content in lists][ordering]. Lower weight gets higher precedence. So content with lower weight will come first.

View file

@ -151,7 +151,7 @@ You can configure an `imaging` section in `config.toml` with default image proce
# See https://github.com/disintegration/imaging
resampleFilter = "box"
# Defatult JPEG quality setting. Default is 75.
# Default JPEG quality setting. Default is 75.
quality = 75
# Anchor used when cropping pictures.

View file

@ -29,6 +29,7 @@ The following is an example of a site configuration for a multilingual Hugo proj
DefaultContentLanguage = "en"
copyright = "Everything is mine"
[params]
[params.navigation]
help = "Help"
@ -48,8 +49,7 @@ linkedin = "https://linkedin.com/fr/whoever"
help = "Aide"
{{< /code-toggle >}}
Anything not defined in a `[languages]` block will fall back to the global
value for that key (e.g., `copyright` for the English [`en`] language).
Anything not defined in a `[languages]` block will fall back to the global value for that key (e.g., `copyright` for the English [`en`] language). This also works for `params`, as demonstrated witgh `help` above: You will get the value `Aide` in French and `Help` in all the languages without this parameter set.
With the configuration above, all content, sitemap, RSS feeds, paginations,
and taxonomy pages will be rendered below `/` in English (your default content language) and then below `/fr` in French.
@ -67,7 +67,7 @@ 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
disableLanguages = ["fr", "jp"]
disableLanguages = ["fr", "ja"]
```
Note that you cannot disable the default content language.
@ -75,7 +75,7 @@ Note that you cannot disable the default content language.
We kept this as a standalone setting to make it easier to set via [OS environment](/getting-started/configuration/#configure-with-environment-variables):
```bash
HUGO_DISABLELANGUAGES="fr jp" hugo
HUGO_DISABLELANGUAGES="fr ja" hugo
```
If you have already a list of disabled languages in `config.toml`, you can enable them in development like this:

View file

@ -17,7 +17,7 @@ menu:
## Properties
ResourceType
: The main type of the resource. For example, a file of MIME type `image/jpg` has for ResourceType `image`.
: The main type of the resource. For example, a file of MIME type `image/jpg` has the ResourceType `image`.
Name
: Default value is the filename (relative to the owning page). Can be set in front matter.
@ -31,6 +31,21 @@ Permalink
RelPermalink
: The relative URL to the resource. Resources of type `page` will have no value.
Content
: The content of the resource itself. For most resources, this returns a string with the contents of the file. This can be used to inline some resources, such as `<script>{{ (.Resources.GetMatch "myscript.js").Content | safeJS }}</script>` or `<img src="{{ (.Resources.GetMatch "mylogo.png").Content | base64Encode }}">`.
MediaType
: The MIME type of the resource, such as `image/jpg`.
MediaType.MainType
: The main type of the resource's MIME type. For example, a file of MIME type `application/pdf` has for MainType `application`.
MediaType.SubType
: The subtype of the resource's MIME type. For example, a file of MIME type `application/pdf` has for SubType `pdf`. Note that this is not the same as the file extension - PowerPoint files have a subtype of `vnd.mspowerpoint`.
MediaType.Suffixes
: A slice of possible suffixes for the resource's MIME type.
## Methods
ByType
: Returns the page resources of the given type.

View file

@ -42,14 +42,14 @@ Here is the list of "Related" methods available on a page collection such `.Regu
Returns a collection of pages related the given one.
```
{{ $related := .RegularPages.Related . }}
{{ $related := .Site.RegularPages.Related . }}
```
#### .RelatedIndices PAGE INDICE1 [INDICE2 ...]
Returns a collection of pages related to a given one restricted to a list of indices.
```
{{ $related := .RegularPages.RelatedIndices . "tags" "date" }}
{{ $related := .Site.RegularPages.RelatedIndices . "tags" "date" }}
```
#### .RelatedTo KEYVALS [KEYVALS2 ...]
@ -58,7 +58,7 @@ Returns a collection of pages related together by a set of indices and their mat
In order to build those set and pass them as argument, one must use the `keyVals` function where the first agrument would be the `indice` and the consective ones its potential `matches`.
```
{{ $related := .RegularPages.RelatedTo ( keyVals "tags" "hugo" "rocks") ( keyVals "date" .Date ) }}
{{ $related := .Site.RegularPages.RelatedTo ( keyVals "tags" "hugo" "rocks") ( keyVals "date" .Date ) }}
```
{{% note %}}

View file

@ -83,7 +83,7 @@ If you're going to contribute code, you'll need to have an account on GitHub. Go
## Install Git on Your System
You will need to have Git installed on your computer to contribute to Hugo development. Teaching Git is outside the scope of the Hugo docs, but if you're looking for an excellent reference to learn the basics of Git, we recommend the [Git book][gitbook] if you are not sure where to begin. We will include short explainations of the Git commands in this document.
You will need to have Git installed on your computer to contribute to Hugo development. Teaching Git is outside the scope of the Hugo docs, but if you're looking for an excellent reference to learn the basics of Git, we recommend the [Git book][gitbook] if you are not sure where to begin. We will include short explanations of the Git commands in this document.
Git is a [version control system](https://en.wikipedia.org/wiki/Version_control) to track the changes of source code. Hugo depends on smaller third-party packages that are used to extend the functionality. We use them because we don't want to reinvent the wheel.
@ -242,7 +242,7 @@ Sometimes changes on the codebase can cause unintended side effects. Or they don
Make sure the commands `go test ./...` passes, and `go build` completes.
### Formatting
The Go code styleguide maybe is opinionated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the styleguide to our addtions:
The Go code styleguide maybe is opinionated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the styleguide to our additions:
```
go fmt ./...

View file

@ -0,0 +1,26 @@
---
title: anchorize
description: Takes a string and sanitizes it the same way as Blackfriday does for markdown headers.
date: 2018-10-13
categories: [functions]
menu:
docs:
parent: "functions"
keywords: [markdown,strings]
signature: ["anchorize INPUT"]
hugoversion: "0.39"
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.
```
{{anchorize "This is a header"}} → "this-is-a-header"
{{anchorize "This is also a header"}} → "this-is-also-a-header"
{{anchorize "main.go"}} → "main-go"
{{anchorize "Article 123"}} → "article-123"
{{anchorize "<- Let's try this, shall we?"}} "let-s-try-this-shall-we"
{{anchorize "Hello, 世界"}} → "hello-世界"
```

View file

@ -14,7 +14,7 @@ keywords: [strings,casing]
signature: ["humanize INPUT"]
workson: []
hugoversion:
relatedfuncs: []
relatedfuncs: [anchorize]
deprecated: false
aliases: []
---
@ -28,4 +28,3 @@ If the input is either an int64 value or the string representation of an integer
{{humanize "52"}} → "52nd"
{{humanize 103}} → "103rd"
```

View file

@ -22,4 +22,4 @@ aliases: []
Just like in the Go programming language, Go and Hugo templates make heavy use of `range` to iterate over a map, array or slice.
`range` is fundamental to templating in Hugo. (See the [Introduction to Hugo Templates](/templates/introduction/) for more examples.
`range` is fundamental to templating in Hugo. (See the [Introduction to Hugo Templates](/templates/introduction/) for more examples.)

View file

@ -126,6 +126,9 @@ languages
languageCode ("")
: The site's language code.
languageName ("")
: The site's language name.
disableLanguages
: See [Disable a Language](/content-management/multilingual/#disable-a-language)

View file

@ -86,10 +86,10 @@ mkdir $HOME/src
cd $HOME/src
git clone https://github.com/gohugoio/hugo.git
cd hugo
go install
go install --tags extended
{{< /code >}}
Remove `HUGO_BUILD_TAGS=extended` if you do not want Sass/SCSS support.
Remove `--tags extended` if you do not want/need Sass/SCSS support.
{{% note %}}
If you are a Windows user, substitute the `$HOME` environment variable above with `%USERPROFILE%`.

View file

@ -39,7 +39,7 @@ You can also use the `..` to refer to a page one level up etc.:
We have now also added language support to `ref` and `relref`, so you can link to a page in another language:
```go-html-template
{{</* relref path="document.md" lang="jp" */>}}
{{</* relref path="document.md" lang="ja" */>}}
```
To link to a given Output Format of a document, you can use this syntax:

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View file

@ -1,8 +1,8 @@
---
date: 2018-09-24
title: "0.49"
description: "0.49"
title: "Hugo 0.49: Directory Based Archetypes"
description: "Hugo 0.49 brings archetype bundle support and collection goodness."
categories: ["Releases"]
---

View file

@ -1,17 +1,15 @@
---
date: 2018-10-10
title: "0.49.1"
description: "0.49.1"
title: "Hugo 0.49.1: Bug Fix"
description: "This release fixes an issue where resources.Concat would sometimes fail."
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png
---
This is a bug-fix release with a 2 related fixed. This was introduced in Hugo 0.49. The most notable error situation was that `resources.Concat` could fail in some situations.
This is a bug-fix release with 2 related fixes. This was introduced in Hugo 0.49. The most notable error situation was that `resources.Concat` could fail in some situations.
* Fix handling of different interface types in Slice [e2201ef1](https://github.com/gohugoio/hugo/commit/e2201ef15fdefe257ad284b2df4ccc8f8c38fac2) [@bep](https://github.com/bep) [#5269](https://github.com/gohugoio/hugo/issues/5269)

View file

@ -1,17 +1,13 @@
---
date: 2018-10-11
title: "0.49.2"
description: "0.49.2"
title: "Hugo 0.49.2: One Bug Fix"
description: "Fixes a type issue in append and Scratch.Add"
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png
---
This is fixes one regression from Hugo `0.42.1`:
This fixes one regression from Hugo `0.42.1`:
* Fix type checking in Append [2159d77f](https://github.com/gohugoio/hugo/commit/2159d77f368eb1f78e51dd94133554f88052d85f) [@bep](https://github.com/bep) [#5303](https://github.com/gohugoio/hugo/issues/5303)

View file

@ -1,21 +1,10 @@
---
# A suitable title for this article.
title: Hugo Showcase Template
# Set this to the current date.
date: 2018-02-07
description: "A short description of this page."
# The URL to the site on the internet.
siteURL: https://gohugo.io/
# Link to the site's Hugo source code if public and you can/want to share.
# Remove or leave blank if not needed/wanted.
siteSource: https://github.com/gohugoio/hugoDocs
# Add credit to the article author. Leave blank or remove if not needed/wanted.
byline: "[bep](https://github.com/bep), Hugo Lead"
---
@ -25,25 +14,9 @@ Have a **notable Hugo site[^1]**? We would love to feature it in this **Showcase
We would really appreciate if you could:
1. Fork https://github.com/gohugoio/hugoDocs
1. Create a copy of the [content/showcase/template](https://github.com/gohugoio/hugoDocs/tree/master/content/showcase/template) directory with a suitable name. If you now run `hugo server`, your site should show up in [http://localhost:1313/showcase/](http://localhost:1313/showcase/) and on the front page.
2. Adjust the [files](#files) and write a story about your site
2. Run `hugo new showcase/your-site` (this requires >= Hugo 0.49). This will use the archetype bundle in the [docs repo](https://github.com/gohugoio/hugoDocs/tree/master/archetypes).
3. Follow the instructions in the newly created page bundle.
3. Create a new pull request in https://github.com/gohugoio/hugoDocs/pulls
**Note:** The Showcase section uses the latest bells and whistles from Hugo, [resources](/content-management/page-resources/) with [image processing](/content-management/image-processing/), so you need a reasonable up-to-date [Hugo version](https://github.com/gohugoio/hugo/releases).
## Files
The content of the [content/showcase/template](https://github.com/gohugoio/hugoDocs/tree/master/content/showcase/template) directory explained:
index.md
: The main content file. Fill in required front matter metadata and write your story. I does not have to be a novel. It can even be self-promotional, but it should include Hugo in some form.
bio.md
: A short summary of the website. Site credits (who built it) fits nicely here.
featured-template.png
: A reasonably sized screenshot of your website. It can be named anything, but the name must start with "featured". The sample image is `1500x750` (2:1 aspect ratio).
[^1]: We want this to show Hugo in its best light, so this is not for the average Hugo blog. In most cases the answer to "Is my site [notabable](http://www.dictionary.com/browse/notable)?" will be obvious, but if in doubt, create an [issue](https://github.com/gohugoio/hugoDocs/issues) with a link and some words, and we can discuss it. But if you have a site with an interesting Hugo story or a company site where the company itself is notable, you are most welcome.
[^1]: We want this to show Hugo in its best light, so this is not for the average Hugo blog. In most cases the answer to "Is my site [notable](http://www.dictionary.com/browse/notable)?" will be obvious, but if in doubt, create an [issue](https://github.com/gohugoio/hugoDocs/issues) with a link and some words, and we can discuss it. But if you have a site with an interesting Hugo story or a company site where the company itself is notable, you are most welcome.

View file

@ -50,6 +50,8 @@ You can then include the Google Analytics internal template:
{{ template "_internal/google_analytics_async.html" . }}
```
A `.Site.GoogleAnalytics` variable is also exposed from the config.
## Disqus
Hugo also ships with an internal template for [Disqus comments][disqus], a popular commenting system for both static and dynamic websites. In order to effectively use Disqus, you will need to secure a Disqus "shortname" by [signing up for the free service][disqussignup].
@ -76,6 +78,8 @@ To add Disqus, include the following line in templates where you want your comme
{{ template "_internal/disqus.html" . }}
```
A `.Site.DisqusShortname` variable is also exposed from the config.
### Conditional Loading of Disqus Comments
Users have noticed that enabling Disqus comments when running the Hugo web server on `localhost` (i.e. via `hugo server`) causes the creation of unwanted discussions on the associated Disqus account.
@ -110,6 +114,85 @@ You can then render your custom Disqus partial template as follows:
{{ partial "disqus.html" . }}
```
## Open Graph
An internal template for the [Open Graph protocol](http://ogp.me/), metadata that enables a page to become a rich object in a social graph.
This format is used for Facebook and some other sites.
### Configure Open Graph
Hugo's Open Graph template is configured using a mix of configuration variables and [front-matter](/content-management/front-matter/) on individual pages.
{{< code-toggle file="config" >}}
[params]
title = "My cool site"
images = ["site-feature-image.jpg"]
description = "Text about my cool site"
[taxonomies]
series = "series"
{{</ code-toggle >}}
{{< code-toggle file="content/blog/my-post" >}}
title = "Post title"
description = "Text about this post"
date = "2006-01-02"
images = ["post-cover.png"]
audio = []
video = []
series = []
tags = []
{{</ code-toggle >}}
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.
Various optional metadata can also be set:
- Date, published date, and last modified data are used to set the published time metadata if specified.
- `audio` and `video` are URL arrays like `images` for the audio and video metadata tags, respectively.
- The first 6 `tags` on the page are used for the tags metadata.
- The `series` taxonomy is used to specify related "see also" pages by placing them in the same series.
### Use the Open Graph Template
To add Open Graph metadata, include the following line between the `<head>` tags in your templates:
```
{{ template "_internal/opengraph.html" . }}
```
## Twitter Cards
An internal template for [Twitter Cards](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards),
metadata used to attach rich media to Tweets linking to your site.
### Configure Twitter Cards
Hugo's Twitter Card template is configured using a mix of configuration variables and [front-matter](/content-management/front-matter/) on individual pages.
{{< code-toggle file="config" >}}
[params]
images = ["site-feature-image.jpg"]
description = "Text about my cool site"
{{</ code-toggle >}}
{{< code-toggle file="content/blog/my-post" >}}
title = "Post title"
description = "Text about this post"
images = ["post-cover.png"]
{{</ code-toggle >}}
If `images` aren't specified in the page front-matter, then hugo searches for [image page resources](/content-management/image-processing/) with `feature`, `cover`, or `thumbnail` in their name.
If no image resources with those names are found, the images defined in the [site config](getting-started/configuration/) are used instead.
If no images are found at all, then an image-less Twitter `summary` card is used instead of `summary_large_image`.
Hugo uses the page title and description for the card's title and description fields. The page summary is used if no description is given.
### Use the Twitter Cards Template
To add Twitter card metadata, include the following line between the `<head>` tags in your templates:
```
{{ template "_internal/twitter_cards.html" . }}
```
## The Internal Templates
* `_internal/disqus.html`

View file

@ -143,7 +143,7 @@ This can be changed by defining an `outputs` list of output formats in either
the `Page` front matter or in the site configuration (either for all sites or
per language).
Example from site config file`:
Example from site config file:
{{< code-toggle file="config" >}}
[outputs]

View file

@ -34,6 +34,14 @@ Hugo's built-in shortcodes cover many common, but not all, use cases. Luckily, H
To create a shortcode, place an HTML template in the `layouts/shortcodes` directory of your [source organization][]. Consider the file name carefully since the shortcode name will mirror that of the file but without the `.html` extension. For example, `layouts/shortcodes/myshortcode.html` will be called with either `{{</* myshortcode /*/>}}` or `{{%/* myshortcode /*/%}}` depending on the type of parameters you choose.
You can organize your shortcodes in subfolders, e.g. in `layouts/shortcodes/boxes`. These shortcodes would then be accessible with their relative path, e.g:
```
{{< boxes/square >}}
```
Note the forward slash.
### Shortcode Template Lookup Order
Shortcode templates have a simple [lookup order][]:
@ -71,6 +79,12 @@ To access a parameter by position, use the `.Get` followed by a numeric position
{{ .Get 0 }}
```
For the second position, you would just use:
```
{{ .Get 1 }}
```
`with` is great when the output depends on a parameter being set:
```

View file

@ -22,6 +22,7 @@ toc: false
* [caddy-hugo](https://github.com/hacdias/caddy-hugo). `caddy-hugo` is an add-on for [Caddy](https://caddyserver.com/) that delivers a good UI to edit the content of your Hugo website.
* [Lipi](https://github.com/SohanChy/Lipi). Lipi is a native GUI frontend written in Java to manage your Hugo websites.
* [Netlify CMS](https://netlifycms.org). Netlify CMS is an open source, serverless solution for managing Git based content in static sites, and it works on any platform that can host static sites. A [Hugo/Netlify CMS starter](https://github.com/netlify-templates/one-click-hugo-cms) is available to get new projects running quickly.
* [Hokus CMS](https://www.hokus.io). Hokus CMS is an open source, multiplatform, easy to use, desktop application for Hugo. Build from simple to complex user interfaces for Hugo websites by choosing from a dozen ready-to-use components — all for free, with no vendor lock-in.
## Commercial Services

View file

@ -21,10 +21,11 @@ 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.
* [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](http://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).
* [hugo-lunr](https://www.npmjs.com/package/hugo-lunr). A simple way to add site search to your static Hugo site using [lunr.js](http://lunrjs.com/). Hugo-lunr will create an index file of any html and markdown documents in your Hugo project.
* [hugo-lunr-zh](https://www.npmjs.com/package/hugo-lunr-zh). A bit like Hugo-lunr, but Hugo-lunr-zh can help you separate the Chinese keywords.
* [Github Gist for Fuse.js integration](https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1cb41ae). This gist demonstrates how to leverage Hugo's existing build time processing to generate a searchable JSON index used by [Fuse.js](http://fusejs.io/) on the client side. Although this gist uses Fuse.js for fuzzy matching, any client side search tool capable of reading JSON indexes will work. Does not require npm, grunt or other build-time tools except Hugo!
* [hugo-search-index](https://www.npmjs.com/package/hugo-search-index). A library containing Gulp tasks and a prebuilt browser script that implements search. Gulp generates a search index from project markdown files.
* [hugo-search-index](https://www.npmjs.com/package/hugo-search-index). A library containing Gulp tasks and a prebuilt browser script that implements search. Gulp generates a search index from project markdown files.
## Commercial Search Services

View file

@ -17,6 +17,10 @@ aliases: [/faq/]
**Note:** The answers/solutions presented below are short, and may not be note be enough to solve your problem. Visit [Hugo Discourse](https://discourse.gohugo.io/) and use the search. It that does not help, start a new topic and ask your questions.
{{% /note %}}
## I can't see my content!
Is your markdown file [in draft mode](https://gohugo.io/content-management/front-matter/#front-matter-variables)? When testing, run `hugo server` with the `-D` or `--buildDrafts` [switch](https://gohugo.io/getting-started/usage/#draft-future-and-expired-content).
## Can I set configuration variables via OS environment?
Yes you can! See [Configure with Environment Variables](/getting-started/configuration/#configure-with-environment-variables).

View file

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