Squashed 'docs/' changes from 715741f73..4e7e1815b
4e7e1815b Fix some typos d23d8f5c4 Remove 'fundamentals' category from function pages 52fa65e15 Mention Chroma as the preferred syntax highlighter 64ca535db Merge commit '8762aee8afe30bec6f1fbc9560749983dc44d60b' 8762aee8a Squashed 'themes/gohugoioTheme/' changes from 396b859f..6f3a8bf5 03f0673a9 Move the gopher to the theme 320e268cd Spelling e45b640f7 More layout lookup work fe0ad9d9d Sync the YAML config menu example with TOML's b9505fc70 Remove template reference to ordinal numbers 0fa2532d3 Remove deprecated Hugoidx, add native hugo solution 2152b907c Fix a link in the last commit 47614f416 Manually specifying heading anchors in Markdown content 9d6770d2a Release notes 0.37.1 e1eed8b27 Remove some unused images e960046f5 releaser: Prepare repository for 0.38-DEV 4fa83a4ee releaser: Add release notes to /docs for release of 0.37.1 46c879995 releaser: Bump versions for release of 0.37.1 fb3ac5a3e releaser: Prepare repository for 0.38-DEV 4870c8e7b Update archetypes.md 232c0b578 Merge commit '2b18014fd0aa99e9f1a5610ba875101351a90de3' 2b18014fd Squashed 'themes/gohugoioTheme/' changes from fe71e360..396b859f 62567e9aa Add some "writing guidelines" 7cfd530d2 Revise the archetype docs 5d4c3c03c Update data-templates.md e5fee3099 Update page-bundles.md ca7f03c8d Update page-bundles.md 2a7fdc269 Fix typo 'vailable' to 'available' line 53 999b75201 LastMod should be Lastmod? 099f46ca5 Fix spacing in content-management/types.md 6bcdc58ef Word choice improvements 20e8a21f6 update rss linking docs 7ef44d262 Add some missing configuration entries f1c7aa568 Sort config list 5cb8ceade Create a proper definition list for the configuration settings 25dffe4ac Send custom dimensions in GA 55df01a34 Fix broken gtag 6c8772aad Add site to GA config e63acb894 Remove conflicting release note for 0.35 f30083a23 Add branch to GA config 99caedb96 Set the small-multiples to draft 4a33c70ab Polish the Small Multiples showcase 7b2f1ea2e Add small multiples showcase e78e96bae Add new sponsor c42943041 updated to new Forestry logo e07eda273 Add OS env to faq 414f0dbc6 Release Hugo 0.37 85f0cc324 Merge branch 'temp37' 1e6da9497 Rebuild images 75e97adfc releaser: Add release notes to /docs for release of 0.37 50b887cb0 releaser: Bump versions for release of 0.37 7acf73ba3 Merge commit '900b5f6cfe5a377ef369d26cd700201be4cf6b06' 819d02c30 Merge commit '374d184e6747678364fd61f5faf328ec9205eb6b' c7eacf018 Fix typos in development contribution doc git-subtree-dir: docs git-subtree-split: 4e7e1815b742659dec1c8f59a1896a3396c7b6e9
|
@ -10,6 +10,12 @@ 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:
|
||||
|
||||
* 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.
|
||||
|
||||
## 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.
|
||||
|
|
|
@ -71,7 +71,7 @@ twitter = "GoHugoIO"
|
|||
[params]
|
||||
description = "The world’s fastest framework for building websites"
|
||||
## Used for views in rendered HTML (i.e., rather than using the .Hugo variable)
|
||||
release = "0.36.1"
|
||||
release = "0.37.1"
|
||||
## Setting this to true will add a "noindex" to *EVERY* page on the site
|
||||
removefromexternalsearch = false
|
||||
## Gh repo for site footer (include trailing slash)
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
---
|
||||
title: Archetypes
|
||||
linktitle: Archetypes
|
||||
description: Archetypes allow you to create new instances of content types and set default parameters from the command line.
|
||||
description: Archetypes are templates used when creating new content.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
keywords: [archetypes,generators,metadata,front matter]
|
||||
categories: ["content management"]
|
||||
menu:
|
||||
|
@ -18,175 +17,59 @@ aliases: [/content/archetypes/]
|
|||
toc: true
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
This section is outdated, see https://github.com/gohugoio/hugoDocs/issues/11
|
||||
{{% /note %}}
|
||||
{{% todo %}}
|
||||
See above
|
||||
{{% /todo %}}
|
||||
|
||||
## What are Archetypes?
|
||||
|
||||
**Archetypes** are content files in the [archetypes directory][] of your project that contain preconfigured [front matter][] for your website's [content types][]. Archetypes facilitate consistent metadata across your website content and allow content authors to quickly generate instances of a content type via the `hugo new` command.
|
||||
**Archetypes** are content template files in the [archetypes directory][] of your project that contain preconfigured [front matter][] and possibly also a content disposition for your website's [content types][]. These will be used when you run `hugo new`.
|
||||
|
||||
{{< youtube bcme8AzVh6o >}}
|
||||
|
||||
The `hugo new` generator for archetypes assumes your working directory is the content folder at the root of your project. Hugo is able to infer the appropriate archetype by assuming the content type from the content section passed to the CLI command:
|
||||
|
||||
```
|
||||
hugo new <content-section>/<file-name.md>
|
||||
```
|
||||
|
||||
We can use this pattern to create a new `.md` file in the `posts` section:
|
||||
The `hugo new` uses the `content-section` to find the most suitable archetype template in your project. If your project does not contain any archetype files, it will also look in the theme.
|
||||
|
||||
{{< code file="archetype-example.sh" >}}
|
||||
hugo new posts/my-first-post.md
|
||||
{{< /code >}}
|
||||
|
||||
{{% note "Override Content Type in a New File" %}}
|
||||
To override the content type Hugo infers from `[content-section]`, add the `--kind` flag to the end of the `hugo new` command.
|
||||
{{% /note %}}
|
||||
|
||||
Running this command in a new site that does not have default or custom archetypes will create the following file:
|
||||
|
||||
{{< output file="content/posts/my-first-post.md" >}}
|
||||
+++
|
||||
date = "2017-02-01T19:20:04-07:00"
|
||||
title = "my first post"
|
||||
draft = true
|
||||
+++
|
||||
{{< /output >}}
|
||||
|
||||
{{% note %}}
|
||||
In this example, if you do not already have a `content/posts` directory, Hugo will create both `content/posts/` and `content/posts/my-first-post.md` for you.
|
||||
{{% /note %}}
|
||||
|
||||
The auto-populated fields are worth examining:
|
||||
|
||||
* `title` is generated from the new content's filename (i.e. in this case, `my-first-post` becomes `"my first post"`)
|
||||
* `date` and `title` are the variables that ship with Hugo and are therefore included in *all* content files created with the Hugo CLI. `date` is generated in [RFC 3339 format][] by way of Go's [`now()`][] function, which returns the current time.
|
||||
* The third variable, `draft = true`, is *not* inherited by your default or custom archetypes but is included in Hugo's automatically scaffolded `default.md` archetype for convenience.
|
||||
|
||||
Three variables per content file are often not enough for effective content management of larger websites. Luckily, Hugo provides a simple mechanism for extending the number of variables through custom archetypes, as well as default archetypes to keep content creation DRY.
|
||||
|
||||
## Lookup Order for Archetypes
|
||||
|
||||
Similar to the [lookup order for templates][lookup] in your `layouts` directory, Hugo looks for a section- or type-specific archetype, then a default archetype, and finally an internal archetype that ships with Hugo. For example, Hugo will look for an archetype for `content/posts/my-first-post.md` in the following order:
|
||||
The above will create a new content file in `content/posts/my-first-post.md` using the first archetype file found of these:
|
||||
|
||||
1. `archetypes/posts.md`
|
||||
2. `archetypes/default.md`
|
||||
3. `themes/<THEME>/archetypes/posts.md`
|
||||
4. `themes/<THEME>/archetypes/default.md` (Auto-generated with `hugo new site`)
|
||||
3. `themes/my-theme/posts.md`
|
||||
4. `themes/my-theme/default.md`
|
||||
|
||||
{{% note "Using a Theme Archetype" %}}
|
||||
If you wish to use archetypes that ship with a theme, the `theme` field must be specified in your [configuration file](/getting-started/configuration/).
|
||||
{{% /note %}}
|
||||
The last two list items is only applicable if you use a theme and it uses the `my-theme` theme name as an example.
|
||||
|
||||
## Choose Your Archetype's Front Matter Format
|
||||
## Create a New Archetype Template
|
||||
|
||||
By default, `hugo new` content files include front matter in the TOML format regardless of the format used in `archetypes/*.md`.
|
||||
A fictional example for the section `newsletter` and the archetype file `archetypes/newsletter.md`. Create a new file in `archetypes/newsletter.md` and open it in a text editor.
|
||||
|
||||
You can specify a different default format in your site [configuration file][] file using the `metaDataFormat` directive. Possible values are `toml`, `yaml`, and `json`.
|
||||
{{< code file="archetypes/newsletter.md" >}}
|
||||
---
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
draft: true
|
||||
---
|
||||
|
||||
## Default Archetypes
|
||||
**Insert Lead paragraph here.**
|
||||
|
||||
Default archetypes are convenient if your content's front matter stays consistent across multiple [content sections][sections].
|
||||
## New Cool Posts
|
||||
|
||||
### Create the Default Archetype
|
||||
|
||||
When you create a new Hugo project using `hugo new site`, you'll notice that Hugo has already scaffolded a file at `archetypes/default.md`.
|
||||
|
||||
The following examples are from a site that's using `tags` and `categories` as [taxonomies][]. If we assume that all content files will require these two key-values, we can create a `default.md` archetype that *extends* Hugo's base archetype. In this example, we are including "golang" and "hugo" as tags and "web development" as a category.
|
||||
|
||||
{{< code file="archetypes/default.md" >}}
|
||||
+++
|
||||
tags = ["golang", "hugo"]
|
||||
categories = ["web development"]
|
||||
+++
|
||||
{{ range first 10 ( where .Site.RegularPages "Type" "cool" ) }}
|
||||
* {{ .Title }}
|
||||
{{ end }}
|
||||
{{< /code >}}
|
||||
|
||||
{{% warning "EOL Characters in Text Editors"%}}
|
||||
If you get an `EOF error` when using `hugo new`, add a carriage return after the closing `+++` or `---` for your TOML or YAML front matter, respectively. (See the [troubleshooting article on EOF errors](/troubleshooting/eof-error/) for more information.)
|
||||
{{% /warning %}}
|
||||
When you create a new newsletter with:
|
||||
|
||||
### Use the Default Archetype
|
||||
```bash
|
||||
hugo new newsletter/the-latest-cool.stuff.md
|
||||
```
|
||||
|
||||
With an `archetypes/default.md` in place, we can use the CLI to create a new post in the `posts` content section:
|
||||
It will create a new newsletter type of content file based on the archetype template.
|
||||
|
||||
{{< code file="new-post-from-default.sh" >}}
|
||||
$ hugo new posts/my-new-post.md
|
||||
{{< /code >}}
|
||||
**Note:** the site will only be built if the `.Site` is in use in the archetype file, and this can be time consuming for big sites.
|
||||
|
||||
Hugo then creates a new markdown file with the following front matter:
|
||||
The above _newsletter type archetype_ illustrates the possibilities: The full Hugo `.Site` and all of Hugo's template funcs can be used in the archetype file.
|
||||
|
||||
{{< output file="content/posts/my-new-post.md" >}}
|
||||
+++
|
||||
categories = ["web development"]
|
||||
date = "2017-02-01T19:20:04-07:00"
|
||||
tags = ["golang", "hugo"]
|
||||
title = "my new post"
|
||||
+++
|
||||
{{< /output >}}
|
||||
|
||||
We see that the `title` and `date` key-values have been added in addition to the `tags` and `categories` key-values from `archetypes/default.md`.
|
||||
|
||||
{{% note "Ordering of Front Matter" %}}
|
||||
You may notice that content files created with `hugo new` do not respect the order of the key-values specified in your archetype files. This is a [known issue](https://github.com/gohugoio/hugo/issues/452).
|
||||
{{% /note %}}
|
||||
|
||||
## Custom Archetypes
|
||||
|
||||
Suppose your site's `posts` section requires more sophisticated front matter than what has been specified in `archetypes/default.md`. You can create a custom archetype for your posts at `archetypes/posts.md` that includes the full set of front matter to be added to the two default archetypes fields.
|
||||
|
||||
### Create a Custom Archetype
|
||||
|
||||
{{< code file="archetypes/posts.md">}}
|
||||
+++
|
||||
description = ""
|
||||
tags = ""
|
||||
categories = ""
|
||||
+++
|
||||
{{< /code >}}
|
||||
|
||||
### Use a Custom Archetype
|
||||
|
||||
With an `archetypes/posts.md` in place, you can use the Hugo CLI to create a new post with your preconfigured front matter in the `posts` content section:
|
||||
|
||||
{{< code file="new-post-from-custom.sh" >}}
|
||||
$ hugo new posts/post-from-custom.md
|
||||
{{< /code >}}
|
||||
|
||||
This time, Hugo recognizes our custom `archetypes/posts.md` archetype and uses it instead of `archetypes/default.md`. The generated file will now include the full list of front matter parameters, as well as the base archetype's `title` and `date`:
|
||||
|
||||
{{< output file="content/posts/post-from-custom-archetype.md" >}}
|
||||
+++
|
||||
categories = ""
|
||||
date = 2017-02-13T17:24:43-08:00
|
||||
description = ""
|
||||
tags = ""
|
||||
title = "post from custom archetype"
|
||||
+++
|
||||
{{< /output >}}
|
||||
|
||||
### Hugo Docs Custom Archetype
|
||||
|
||||
As an example of archetypes in practice, the following is the `functions` archetype from the Hugo docs:
|
||||
|
||||
{{< code file="archetypes/functions.md" >}}
|
||||
{{< readfile file="/archetypes/functions.md" >}}
|
||||
{{< /code >}}
|
||||
|
||||
{{% note %}}
|
||||
The preceding archetype is kept up to date with every Hugo build by using Hugo's [`readFile` function](/functions/readfile/). For similar examples, see [Local File Templates](/templates/files/).
|
||||
{{% /note %}}
|
||||
|
||||
[archetypes directory]: /getting-started/directory-structure/
|
||||
[`now()`]: http://golang.org/pkg/time/#Now
|
||||
[configuration file]: /getting-started/configuration/
|
||||
[sections]: /content-management/sections/
|
||||
[content types]: /content-management/types/
|
||||
[front matter]: /content-management/front-matter/
|
||||
[RFC 3339 format]: https://www.ietf.org/rfc/rfc3339.txt
|
||||
[taxonomies]: /content-management/taxonomies/
|
||||
[lookup]: /templates/lookup/
|
||||
[templates]: /templates/
|
||||
|
|
|
@ -109,8 +109,22 @@ Ensuring heading uniqueness across the site is accomplished with a unique identi
|
|||
/content-management/cross-references/#hugo-heading-anchors:77cd9ea530577debf4ce0f28c8dca242
|
||||
```
|
||||
|
||||
### Manually Specifying Anchors
|
||||
|
||||
For Markdown content files, if the `headerIds` [Blackfriday extension][bfext] is
|
||||
enabled (which it is by default), user can manually specify the anchor for any
|
||||
heading.
|
||||
|
||||
Few examples:
|
||||
|
||||
```
|
||||
## Alpha 101 {#alpha}
|
||||
|
||||
## Version 1.0 {#version-1-dot-0}
|
||||
```
|
||||
|
||||
[built-in Hugo shortcodes]: /content-management/shortcodes/#using-the-built-in-shortcodes
|
||||
[lists]: /templates/lists/
|
||||
[output formats]: /templates/output-formats/
|
||||
[shortcode]: /content-management/shortcodes/
|
||||
[bfext]: /content-management/formats/#blackfriday-extensions
|
||||
|
|
|
@ -84,7 +84,7 @@ See [Shortcodes][sc] for usage, particularly for the built-in shortcodes that sh
|
|||
|
||||
### Code Blocks
|
||||
|
||||
Hugo supports GitHub-flavored markdown's use of triple back ticks, as well as provides a special [`highlight` nested shortcode][hlsc] to render syntax highlighting via [Pygments][]. For usage examples and a complete explanation, see the [syntax highlighting documentation][hl] in [developer tools][].
|
||||
Hugo supports GitHub-flavored markdown's use of triple back ticks, as well as provides a special [`highlight` shortcode][hlsc], and syntax highlights those code blocks natively using *Chroma*. Users also have an option to use *Pygments* instead. See the [Syntax Highlighting][hl] section for details.
|
||||
|
||||
## Mmark
|
||||
|
||||
|
@ -231,7 +231,7 @@ Markdown syntax is simple enough to learn in a single sitting. The following are
|
|||
[fireball]: https://daringfireball.net/projects/markdown/
|
||||
[gfmtasks]: https://guides.github.com/features/mastering-markdown/#syntax
|
||||
[helperssource]: https://github.com/gohugoio/hugo/blob/77c60a3440806067109347d04eb5368b65ea0fe8/helpers/general.go#L65
|
||||
[hl]: /tools/syntax-highlighting/
|
||||
[hl]: /content-management/syntax-highlighting/
|
||||
[hlsc]: /content-management/shortcodes/#highlight
|
||||
[hugocss]: /css/style.css
|
||||
[ietf]: https://tools.ietf.org/html/
|
||||
|
|
|
@ -137,19 +137,17 @@ Here’s an example snippet pulled from a `config.toml`:
|
|||
Here's the equivalent snippet in a `config.yaml`:
|
||||
|
||||
{{< code file="config.yml" >}}
|
||||
---
|
||||
menu:
|
||||
docs:
|
||||
- Name: "about hugo"
|
||||
Pre: "<i class='fa fa-heart'></i>"
|
||||
Weight: -110
|
||||
Identifier: "about"
|
||||
URL: "/about/"
|
||||
- Name: "getting started"
|
||||
Pre: "<i class='fa fa-road'></i>"
|
||||
Weight: -100
|
||||
URL: "/getting-started/"
|
||||
---
|
||||
main:
|
||||
- name: "about hugo"
|
||||
pre: "<i class='fa fa-heart'></i>"
|
||||
weight: -110
|
||||
identifier: "about"
|
||||
url: "/about/"
|
||||
- name: "getting started"
|
||||
pre: "<i class='fa fa-road'></i>"
|
||||
weight: -100
|
||||
url: "/getting-started/"
|
||||
{{< /code >}}
|
||||
|
||||
{{% note %}}
|
||||
|
|
|
@ -6,7 +6,6 @@ lastmod : 2018-01-28T22:26:40-05:00
|
|||
linktitle : "Page Bundles"
|
||||
keywords : ["page", "bundle", "leaf", "branch"]
|
||||
categories : ["content management"]
|
||||
draft : true
|
||||
toc : true
|
||||
menu :
|
||||
docs:
|
||||
|
@ -15,19 +14,16 @@ menu :
|
|||
weight : 11
|
||||
---
|
||||
|
||||
Page Bundles are a way to organize the content files. It's useful for
|
||||
cases where a page or section's content needs to be split into
|
||||
multiple content pages for convenience or has associated attachments
|
||||
like documents or images.
|
||||
Page Bundles are a way to group [Page Resources](/content-management/page-resources/).
|
||||
|
||||
A Page Bundle can be one of two types:
|
||||
A Page Bundle can be one of:
|
||||
|
||||
- Leaf Bundle
|
||||
- Branch Bundle
|
||||
- Leaf Bundle (leaf means it has no children)
|
||||
- Branch Bundle (home page, section, taxonomy terms, taxonomy list)
|
||||
|
||||
| | Leaf Bundle | Branch Bundle |
|
||||
|-----------------|--------------------------------------------------------|---------------------------------------------------------|
|
||||
| Usage | Collection of content and attachments for single pages | Collection of content and attachments for section pages |
|
||||
| Usage | Collection of resources (pages, images etc.) for single pages | Collection of non-page resources (images etc.)for list pages |
|
||||
| Index file name | `index.md` [^fn:1] | `_index.md` [^fn:1] |
|
||||
| Layout type | `single` | `list` |
|
||||
| Nesting | Doesn't allow nesting of more bundles under it | Allows nesting of leaf/branch bundles under it |
|
||||
|
@ -37,15 +33,7 @@ A Page Bundle can be one of two types:
|
|||
## Leaf Bundles {#leaf-bundles}
|
||||
|
||||
A _Leaf Bundle_ is a directory at any hierarchy within the `content/`
|
||||
directory, that contains at least an **`index.md`** file.
|
||||
|
||||
{{% note %}}
|
||||
Here `md` (markdown) is used just as an example. You can use any file
|
||||
type as a content resource as long as it is a MIME type recognized by
|
||||
Hugo (`json` files will, as one example, work fine). If you want to
|
||||
get exotic, you can define your own media type.
|
||||
{{% /note %}}
|
||||
|
||||
directory, that contains an **`index.md`** file.
|
||||
|
||||
### Examples of Leaf Bundle organization {#examples-of-leaf-bundle-organization}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ Git is a [version control system](https://en.wikipedia.org/wiki/Version_control)
|
|||
|
||||
Go ships with a sub-command called `get` that will download these packages for us when we setup our working environment. The source code of the packages is tracked with Git. `get` will interact with the Git servers of the package hosters in order to fetch all dependencies.
|
||||
|
||||
Move back to the terminal and check if Git is already installed. Type in `git version` and press enter. You can skip the rest of this section if the command returned a version number. Otherwise [download](https://git-scm.com/downloads) the lastest version of Git and follow this [installation guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
||||
Move back to the terminal and check if Git is already installed. Type in `git version` and press enter. You can skip the rest of this section if the command returned a version number. Otherwise [download](https://git-scm.com/downloads) the latest version of Git and follow this [installation guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
||||
|
||||
Finally, check again with `git version` if Git was installed successfully.
|
||||
|
||||
|
@ -147,7 +147,7 @@ go get github.com/stretchr/testify
|
|||
|
||||
### Fork the repository
|
||||
|
||||
If you're not fimiliar with this term, GitHub's [help pages](https://help.github.com/articles/fork-a-repo/) provide again a simple explanation:
|
||||
If you're not familiar with this term, GitHub's [help pages](https://help.github.com/articles/fork-a-repo/) provide again a simple explanation:
|
||||
|
||||
> A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.
|
||||
|
||||
|
@ -219,7 +219,7 @@ Now we can create a new branch for your additions:
|
|||
git checkout -b <BRANCH-NAME>
|
||||
```
|
||||
|
||||
You can check on which branch your are with `git branch`. You should see a list of all local branches. The current branch is indicated with a little asterisk.
|
||||
You can check on which branch you are with `git branch`. You should see a list of all local branches. The current branch is indicated with a little asterisk.
|
||||
|
||||
### Contribute to Documentation
|
||||
|
||||
|
@ -243,7 +243,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 opiniated 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 addtions:
|
||||
|
||||
```
|
||||
go fmt ./...
|
||||
|
@ -280,7 +280,7 @@ git log
|
|||
# Exit with q
|
||||
```
|
||||
|
||||
After making the last commit you may forgot something. There is no need to create a new commit. Just add the latest changes and merge them into the intended commit:
|
||||
After making the last commit you may have forgot something. There is no need to create a new commit. Just add the latest changes and merge them into the intended commit:
|
||||
|
||||
```
|
||||
git add --all
|
||||
|
@ -348,7 +348,7 @@ Check the commit log if everything looks as expected. Should an error occur you
|
|||
|
||||
### Push commits
|
||||
|
||||
To push our commits to the fork on GitHub we need to speficy a destination. A destination is defined by the remote and a branch name. Earlier, the defined that the remote url of our fork is the same as our GitHub handle, in my case `digitalcraftsman`. The branch should have the same as our local one. This makes it easy to identify corresponding branches.
|
||||
To push our commits to the fork on GitHub we need to specify a destination. A destination is defined by the remote and a branch name. Earlier, the defined that the remote url of our fork is the same as our GitHub handle, in my case `digitalcraftsman`. The branch should have the same as our local one. This makes it easy to identify corresponding branches.
|
||||
|
||||
```
|
||||
git push --set-upstream <YOUR-GITHUB-USERNAME> <BRANCHNAME>
|
||||
|
@ -362,7 +362,7 @@ If you modified your commit history in the last step GitHub will reject your try
|
|||
|
||||
We made a lot of progress. Good work. In this step we finally open a pull request to submit our additions. Open the [Hugo master repository](https://github.com/gohugoio/hugo/) on GitHub in your browser.
|
||||
|
||||
You should find a green button labeld with "New pull request". But GitHub is clever and probably suggests you a pull request like in the beige box below:
|
||||
You should find a green button labeled with "New pull request". But GitHub is clever and probably suggests you a pull request like in the beige box below:
|
||||
|
||||
![Open a pull request](/images/contribute/development/open-pull-request.png)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: .Format
|
||||
description: Formats built-in Hugo dates---`.Date`, `.PublishDate`, and `.LastMod`---according to Go's layout string.
|
||||
description: Formats built-in Hugo dates---`.Date`, `.PublishDate`, and `.Lastmod`---according to Go's layout string.
|
||||
godocref: https://golang.org/pkg/time/#example_Time_Format
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
|
@ -23,7 +23,7 @@ toc: true
|
|||
|
||||
* `.PublishDate`
|
||||
* `.Date`
|
||||
* `.LastMod`
|
||||
* `.Lastmod`
|
||||
|
||||
Assuming a key-value of `date: 2017-03-03` in a content file's front matter, your can run the date through `.Format` followed by a layout string for your desired output at build time:
|
||||
|
||||
|
@ -69,9 +69,6 @@ date: 2017-03-03T14:15:59-06:00
|
|||
`"Mon Jan 2 2006"`
|
||||
: **Returns**: `Fri Mar 3 2017`
|
||||
|
||||
`"January 2nd"`
|
||||
: **Returns**: `March 3rd`
|
||||
|
||||
`"January 2006"`
|
||||
: **Returns**: `March 2017`
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ pop_city = 658390
|
|||
pop_metro = 1717900
|
||||
```
|
||||
|
||||
The example we will use will be an article on Oslo, which front matter should set to exactly the same name as the corresponding file name in `data/locations/`:
|
||||
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/`:
|
||||
|
||||
```
|
||||
title = "My Norwegian Vacation"
|
||||
|
|
|
@ -6,7 +6,7 @@ godocref:
|
|||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions,fundamentals]
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
|
|
|
@ -6,7 +6,7 @@ godocref:
|
|||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions,fundamentals]
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
|
|
|
@ -50,7 +50,7 @@ It can also be used with the logical operators `!=`, `>=`, `in`, etc. Without an
|
|||
{{ end }}
|
||||
```
|
||||
|
||||
The following logical operators are vailable with `where`:
|
||||
The following logical operators are available with `where`:
|
||||
|
||||
`=`, `==`, `eq`
|
||||
: `true` if a given field value equals a matching value
|
||||
|
|
|
@ -6,7 +6,7 @@ godocref:
|
|||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-03-12
|
||||
categories: [functions,fundamentals]
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Configure Hugo
|
||||
linktitle: Configuration
|
||||
description: Often the default settings are good enough, but the config file can provide highly granular control over how your site is rendered.
|
||||
description: How to configure your Hugo site.
|
||||
date: 2013-07-01
|
||||
publishdate: 2017-01-02
|
||||
lastmod: 2017-03-05
|
||||
|
@ -18,9 +18,201 @@ aliases: [/overview/source-directory/,/overview/configuration/]
|
|||
toc: true
|
||||
---
|
||||
|
||||
The [directory structure][] of a Hugo website—or more precisely, the source organization of files containing the website's content and templates—provides most of the configuration information that Hugo needs in order to generate a finished website.
|
||||
|
||||
Because of Hugo's sensible defaults, many websites may not need a configuration file. Hugo is designed to recognize certain typical usage patterns.
|
||||
## All Configuration Settings
|
||||
|
||||
The following is the full list of Hugo-defined variables with its default value in parens.
|
||||
|
||||
archetypeDir ("archetypes")
|
||||
: The directory where Hugo finds archetype files (content templates).
|
||||
|
||||
baseURL
|
||||
: Hostname (and path) to the root, e.g. http://bep.is/
|
||||
|
||||
buildDrafts (false)
|
||||
: Include drafts when building.
|
||||
|
||||
buildExpired (false)
|
||||
: Include content already expired.
|
||||
|
||||
buildFuture (false)
|
||||
: Include content with publishdate in the future.
|
||||
|
||||
canonifyURLs (false)
|
||||
: Enable to turn relative URLs into absolute.
|
||||
|
||||
config ("config.toml")
|
||||
: Config file (default is path/config.yaml|json|toml).
|
||||
|
||||
contentDir ("content")
|
||||
: The directory from where Hugo reads content files.
|
||||
|
||||
dataDir ("data")
|
||||
: The directory from where Hugo reads data files.
|
||||
|
||||
defaultContentLanguage ("en")
|
||||
: Content without language indicator will default to this language.
|
||||
|
||||
defaultContentLanguageInSubdir (false)
|
||||
: Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/.
|
||||
|
||||
disableHugoGeneratorInject (false)
|
||||
: Hugo will, by default, inject a generator meta tag in the HTML head on the _home page only_. You can turn it off, but we would really appreciate if you don't, as this is a good way to watch Hugo's popularity on the rise.
|
||||
|
||||
disableKinds ([])
|
||||
: Allows you to disable all page types and will render nothing related to 'kind'. Allowed values are "page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404".
|
||||
|
||||
disableLiveReload (false)
|
||||
: Turn off automatic live reloading of browser window.
|
||||
|
||||
disablePathToLower (false)
|
||||
: Do not make the url/path to lowercase.
|
||||
|
||||
enableEmoji (false)
|
||||
: Enable Emoji emoticons support for page content; see emoji-cheat-sheet.com.
|
||||
|
||||
enableGitInfo (false)
|
||||
: If the Hugo site is versioned by Git, you will then get a `.GitInfo` object per page, and `Lastmod` will get updated by the last commit date for content.
|
||||
|
||||
enableMissingTranslationPlaceholders (false)
|
||||
: Show a placeholder instead of the default value or an empty string if a translation is missing
|
||||
|
||||
enableRobotsTXT (false)
|
||||
: When enabled, Hugo will generate a `robots.txt` file.
|
||||
|
||||
footnoteAnchorPrefix ("")
|
||||
: A prefix for your footnote anchors.
|
||||
|
||||
footnoteReturnLinkContents ("")
|
||||
: A return link for your footnote.
|
||||
|
||||
googleAnalytics ("")
|
||||
: google analytics tracking id
|
||||
|
||||
hasCJKLanguage (false)
|
||||
: If true, auto-detect Chinese/Japanese/Korean Languages in the content. This will make `.Summary` and `.WordCount` behave correctly in CJK languages.
|
||||
|
||||
imaging
|
||||
: See [Image Processing Config](/content-management/image-processing/#image-processing-config).
|
||||
|
||||
languages
|
||||
: See [Configure Languages](/content-management/multilingual/#configure-languages).
|
||||
|
||||
languageCode ("")
|
||||
: The site's language code.
|
||||
|
||||
layoutDir ("layouts")
|
||||
: The directory from where Hugo reads layouts (templates).
|
||||
|
||||
log (false)
|
||||
: Enable logging.
|
||||
|
||||
logFile ("")
|
||||
: Log File path (if set, logging enabled automatically).
|
||||
|
||||
menu
|
||||
: See [Add Non-content Entries to a Menu](/content-management/menus/#add-non-content-entries-to-a-menu).
|
||||
|
||||
metaDataFormat ("toml")
|
||||
: "toml","yaml", or "json"
|
||||
|
||||
newContentEditor ("")
|
||||
: The editor to use when creating new content.
|
||||
|
||||
noChmod (false)
|
||||
: Don't sync permission mode of files.
|
||||
|
||||
noTimes (false)
|
||||
: Don't sync modification time of files
|
||||
|
||||
paginate (10)
|
||||
: Default number of pages per page in pagination.
|
||||
|
||||
paginatePath ("page")
|
||||
: The path element used during pagination (http://example.com/page/2).
|
||||
|
||||
permalinks
|
||||
: See [Content Management](/content-management/urls/#permalinks)
|
||||
|
||||
pluralizeListTitles (true)
|
||||
: Pluralize titles in lists using inflect.
|
||||
|
||||
preserveTaxonomyNames (false)
|
||||
: Preserve special characters in taxonomy names ("Gérard Depardieu" vs "Gerard Depardieu").
|
||||
|
||||
publishDir ("public")
|
||||
: The directory to where Hugo will write the final static site (the HTML files etc.).
|
||||
|
||||
pygmentsCodeFencesGuessSyntax (false)
|
||||
: Enables syntax guessing for code fences without specified language.
|
||||
|
||||
pygmentsStyle ("monokai")
|
||||
: Color-codes for highlighting derived from this style. See https://help.farbox.com/pygments.html
|
||||
|
||||
pygmentsUseClasses (false)
|
||||
: Enable to use external CSS for code highlighting.
|
||||
|
||||
related
|
||||
: See [Related Content](/content-management/related/#configure-related-content).
|
||||
|
||||
relativeURLs (false)
|
||||
: Enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs.
|
||||
|
||||
rssLimit (15)
|
||||
: Maximum number of items in the RSS feed.
|
||||
|
||||
sectionPagesMenu ("")(
|
||||
: See ["Section Menu for Lazy Bloggers"](/templates/menu-templates/#section-menu-for-lazy-bloggers).
|
||||
|
||||
sitemap
|
||||
: Default sitemap configuration.
|
||||
|
||||
staticDir ("static")
|
||||
: Relative directory from where Hugo reads static files.
|
||||
|
||||
stepAnalysis (false)
|
||||
: Display memory and timing of different steps of the program.
|
||||
|
||||
summaryLength (70)
|
||||
: The length of text to show in a `.Summary`.
|
||||
|
||||
taxonomies
|
||||
: See [Configure Taxonomies](content-management/taxonomies#configure-taxonomies)
|
||||
|
||||
theme ("")
|
||||
: Theme to use (located by default in /themes/THEMENAME/)
|
||||
|
||||
themesDir ("themes")
|
||||
: The directory where Hugo reads the themes from.
|
||||
|
||||
title ("")
|
||||
: Site title.
|
||||
|
||||
uglyURLs (false)
|
||||
: When enabled creates URL on the form `/filename.html` instead of `/filename/`
|
||||
|
||||
verbose (false)
|
||||
: Enable verbose output.
|
||||
|
||||
verboseLog (false)
|
||||
: Enable verbose logging.
|
||||
|
||||
watch (false)
|
||||
: Watch filesystem for changes and recreate as needed.
|
||||
|
||||
{{% note %}}
|
||||
If you are developing your site on a \*nix machine, here is a handy shortcut for finding a configuration option from the command line:
|
||||
```
|
||||
cd ~/sites/yourhugosite
|
||||
hugo config | grep emoji
|
||||
```
|
||||
|
||||
which shows output like
|
||||
|
||||
```
|
||||
enableemoji: true
|
||||
```
|
||||
{{% /note %}}
|
||||
|
||||
## Configuration Lookup Order
|
||||
|
||||
|
@ -52,120 +244,6 @@ params:
|
|||
SidebarRecentLimit: 5
|
||||
{{< /code >}}
|
||||
|
||||
### All Variables, YAML
|
||||
|
||||
The following is the full list of Hugo-defined variables in an example YAML file. The values provided in this example represent the default values used by Hugo.
|
||||
|
||||
{{< code file="config.yml" download="config.yml" >}}
|
||||
archetypeDir: "archetypes"
|
||||
# hostname (and path) to the root, e.g. http://spf13.com/
|
||||
baseURL: ""
|
||||
# include content marked as draft
|
||||
buildDrafts: false
|
||||
# include content with publishdate in the future
|
||||
buildFuture: false
|
||||
# include content already expired
|
||||
buildExpired: false
|
||||
# enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs. See the "URL Management" page
|
||||
relativeURLs: false
|
||||
canonifyURLs: false
|
||||
# config file (default is path/config.yaml|json|toml)
|
||||
config: "config.toml"
|
||||
contentDir: "content"
|
||||
dataDir: "data"
|
||||
defaultLayout: "post"
|
||||
# Missing translations will default to this content language
|
||||
defaultContentLanguage: "en"
|
||||
# Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/
|
||||
defaultContentLanguageInSubdir: false
|
||||
disableLiveReload: false
|
||||
# Enable GitInfo feature
|
||||
enableGitInfo: false
|
||||
# Build robots.txt file
|
||||
enableRobotsTXT: false
|
||||
# Do not inject generator meta tag on homepage
|
||||
disableHugoGeneratorInject: false
|
||||
# Allows you to disable all page types and will render nothing related to 'kind';
|
||||
# values = "page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"
|
||||
disableKinds: []
|
||||
# Do not make the url/path to lowercase
|
||||
disablePathToLower: false ""
|
||||
# Enable Emoji emoticons support for page content; see emoji-cheat-sheet.com
|
||||
enableEmoji: false
|
||||
# Show a placeholder instead of the default value or an empty string if a translation is missing
|
||||
enableMissingTranslationPlaceholders: false
|
||||
footnoteAnchorPrefix: ""
|
||||
footnoteReturnLinkContents: ""
|
||||
# google analytics tracking id
|
||||
googleAnalytics: ""
|
||||
# if true, auto-detect Chinese/Japanese/Korean Languages in the content. (.Summary and .WordCount can work properly in CJKLanguage)
|
||||
hasCJKLanguage: false
|
||||
languageCode: ""
|
||||
# the length of text to show in a .Summary
|
||||
summaryLength: 70
|
||||
layoutDir: "layouts"
|
||||
# Enable Logging
|
||||
log: false
|
||||
# Log File path (if set, logging enabled automatically)
|
||||
logFile: ""
|
||||
# "toml","yaml", or "json"
|
||||
metaDataFormat: "toml"
|
||||
newContentEditor: ""
|
||||
# Don't sync permission mode of files
|
||||
noChmod: false
|
||||
# Don't sync modification time of files
|
||||
noTimes: false
|
||||
# Pagination
|
||||
paginate: 10
|
||||
paginatePath: "page"
|
||||
# See "content-management/permalinks"
|
||||
permalinks:
|
||||
# Pluralize titles in lists using inflect
|
||||
pluralizeListTitles: true
|
||||
# Preserve special characters in taxonomy names ("Gérard Depardieu" vs "Gerard Depardieu")
|
||||
preserveTaxonomyNames: false
|
||||
# filesystem path to write files to
|
||||
publishDir: "public"
|
||||
# enables syntax guessing for code fences without specified language
|
||||
pygmentsCodeFencesGuessSyntax: false
|
||||
# color-codes for highlighting derived from this style
|
||||
pygmentsStyle: "monokai"
|
||||
# true use pygments-css or false will color code directly
|
||||
pygmentsUseClasses: false
|
||||
# maximum number of items in the RSS feed
|
||||
rssLimit: 15
|
||||
# see "Section Menu for Lazy Bloggers", /templates/menu-templates for more info
|
||||
SectionPagesMenu: ""
|
||||
# default sitemap configuration map
|
||||
sitemap:
|
||||
# filesystem path to read files relative from
|
||||
source: ""
|
||||
staticDir: "static"
|
||||
# display memory and timing of different steps of the program
|
||||
stepAnalysis: false
|
||||
# display metrics about template executions
|
||||
templateMetrics: false
|
||||
# theme to use (located by default in /themes/THEMENAME/)
|
||||
themesDir: "themes"
|
||||
theme: ""
|
||||
title: ""
|
||||
# Title Case style guide for the title func and other automatic title casing in Hugo.
|
||||
// Valid values are "AP" (default), "Chicago" and "Go" (which was what you had in Hugo <= 0.25.1).
|
||||
// See https://www.apstylebook.com/ and http://www.chicagomanualofstyle.org/home.html
|
||||
titleCaseStyle: "AP"
|
||||
# if true, use /filename.html instead of /filename/
|
||||
uglyURLs: false
|
||||
# verbose output
|
||||
verbose: false
|
||||
# verbose logging
|
||||
verboseLog: false
|
||||
# watch filesystem for changes and recreate as needed
|
||||
watch: true
|
||||
taxonomies:
|
||||
- category: "categories"
|
||||
- tag: "tags"
|
||||
{{< /code >}}
|
||||
|
||||
## TOML Configuration
|
||||
|
||||
The following is an example of a TOML configuration file. The values under `[params]` will populate the `.Site.Params` variable for use in [templates][]:
|
||||
|
@ -188,128 +266,10 @@ title = "My Hugo Site"
|
|||
author = "John Doe"
|
||||
{{< /code >}}
|
||||
|
||||
### All Variables, TOML
|
||||
|
||||
The following is the full list of Hugo-defined variables in an example TOML file. The values provided in this example represent the default values used by Hugo.
|
||||
|
||||
{{< code file="config.toml" download="config.toml">}}
|
||||
archetypeDir = "archetypes"
|
||||
# hostname (and path) to the root, e.g. http://spf13.com/
|
||||
baseURL = ""
|
||||
# include content marked as draft
|
||||
buildDrafts = false
|
||||
# include content with publishdate in the future
|
||||
buildFuture = false
|
||||
# include content already expired
|
||||
buildExpired = false
|
||||
# enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs.
|
||||
relativeURLs = false
|
||||
canonifyURLs = false
|
||||
# config file (default is path/config.yaml|json|toml)
|
||||
config = "config.toml"
|
||||
contentDir = "content"
|
||||
dataDir = "data"
|
||||
defaultLayout = "post"
|
||||
# Missing translations will default to this content language
|
||||
defaultContentLanguage = "en"
|
||||
# Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/
|
||||
defaultContentLanguageInSubdir = false
|
||||
disableLiveReload = false
|
||||
# Enable GitInfo feature
|
||||
enableGitInfo = false
|
||||
# Build robots.txt file
|
||||
enableRobotsTXT = false
|
||||
# Do not inject generator meta tag on homepage
|
||||
disableHugoGeneratorInject = false
|
||||
# Allows you to disable all page types and will render nothing related to 'kind';
|
||||
# values = "page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"
|
||||
disableKinds = []
|
||||
# Do not make the url/path to lowercase
|
||||
disablePathToLower = false
|
||||
# Enable Emoji emoticons support for page content; see emoji-cheat-sheet.com
|
||||
enableEmoji = false
|
||||
# Show a placeholder instead of the default value or an empty string if a translation is missing
|
||||
enableMissingTranslationPlaceholders = false
|
||||
footnoteAnchorPrefix = ""
|
||||
footnoteReturnLinkContents = ""
|
||||
# google analytics tracking id
|
||||
googleAnalytics = ""
|
||||
# if true, auto-detect Chinese/Japanese/Korean Languages in the content. (.Summary and .WordCount can work properly in CJKLanguage)
|
||||
hasCJKLanguage = false
|
||||
languageCode = ""
|
||||
# the length of text to show in a .Summary
|
||||
summaryLength = 70
|
||||
layoutDir = "layouts"
|
||||
# Enable Logging
|
||||
log = false
|
||||
# Log File path (if set, logging enabled automatically)
|
||||
logFile =
|
||||
# maximum number of items in the RSS feed
|
||||
rssLimit = 15
|
||||
# "toml","yaml", or "json"
|
||||
metaDataFormat = "toml"
|
||||
newContentEditor = ""
|
||||
# Don't sync permission mode of files
|
||||
noChmod = false
|
||||
# Don't sync modification time of files
|
||||
noTimes = false
|
||||
# Pagination
|
||||
paginate = 10
|
||||
paginatePath = "page"
|
||||
# See "content-management/permalinks"
|
||||
permalinks =
|
||||
# Pluralize titles in lists using inflect
|
||||
pluralizeListTitles = true
|
||||
# Preserve special characters in taxonomy names ("Gérard Depardieu" vs "Gerard Depardieu")
|
||||
preserveTaxonomyNames = false
|
||||
# filesystem path to write files to
|
||||
publishDir = "public"
|
||||
# enables syntax guessing for code fences without specified language
|
||||
pygmentsCodeFencesGuessSyntax = false
|
||||
# color-codes for highlighting derived from this style
|
||||
pygmentsStyle = "monokai"
|
||||
# true: use pygments-css or false: color-codes directly
|
||||
pygmentsUseClasses = false
|
||||
# see "Section Menu for Lazy Bloggers", /templates/menu-templates for more info
|
||||
SectionPagesMenu =
|
||||
# default sitemap configuration map
|
||||
sitemap =
|
||||
# filesystem path to read static files relative from
|
||||
staticDir = "static"
|
||||
# display memory and timing of different steps of the program
|
||||
stepAnalysis = false
|
||||
# theme to use (located by default in /themes/THEMENAME/)
|
||||
themesDir = "themes"
|
||||
theme = ""
|
||||
title = ""
|
||||
# if true, use /filename.html instead of /filename/
|
||||
uglyURLs = false
|
||||
# verbose output
|
||||
verbose = false
|
||||
# verbose logging
|
||||
verboseLog = false
|
||||
# watch filesystem for changes and recreate as needed
|
||||
watch = true
|
||||
[taxonomies]
|
||||
category = "categories"
|
||||
tag = "tags"
|
||||
{{< /code >}}
|
||||
|
||||
{{% note %}}
|
||||
If you are developing your site on a \*nix machine, here is a handy shortcut for finding a configuration option from the command line:
|
||||
```
|
||||
cd ~/sites/yourhugosite
|
||||
hugo config | grep emoji
|
||||
```
|
||||
|
||||
which shows output like
|
||||
|
||||
```
|
||||
enableemoji: true
|
||||
```
|
||||
{{% /note %}}
|
||||
|
||||
## Environmental Variables
|
||||
## Configure with Environment Variables
|
||||
|
||||
In addition to the 3 config options already mentioned, configuration key-values can be defined through operating system environment variables.
|
||||
|
||||
|
@ -319,10 +279,16 @@ For example, the following command will effectively set a website's title on Uni
|
|||
$ env HUGO_TITLE="Some Title" hugo
|
||||
```
|
||||
|
||||
This is really useful if you use a service such as Netlify to deploy your site. Look at the Hugo docs [Netlify configuration file](https://github.com/gohugoio/hugoDocs/blob/master/netlify.toml) for an example.
|
||||
|
||||
{{% note "Setting Environment Variables" %}}
|
||||
Names must be prefixed with `HUGO_` and the configuration key must be set in uppercase when setting operating system environment variables.
|
||||
{{% /note %}}
|
||||
|
||||
{{< todo >}}
|
||||
Test and document setting params via JSON env var.
|
||||
{{< /todo >}}
|
||||
|
||||
## Ignore Files When Rendering
|
||||
|
||||
The following statement inside `./config.toml` will cause Hugo to ignore files ending with `.foo` and `.boo` when rendering:
|
||||
|
|
BIN
content/news/0.37-relnotes/featured-hugo-37-poster.png
Normal file
After Width: | Height: | Size: 182 KiB |
76
content/news/0.37-relnotes/index.md
Normal file
|
@ -0,0 +1,76 @@
|
|||
|
||||
---
|
||||
date: 2018-02-27
|
||||
title: "Hugo 0.37: Preserve PNG Colour Palette"
|
||||
description: "Reduces processed PNG file sizes. And 0.37 is built with Go 1.10!"
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
The main item in Hugo `0.37` is that we now properly preserve the colour palette when processing `PNG` images. We got reports from users experiencing their `PNG` images getting bigger in file size when scaled down. Now, if you, as an example, start out with a carefully chosen 8 bit colour palette (i.e. `PNG-8`), this is now what you will end up with. A special thanks to [@aitva](https://github.com/aitva) for doing the investigative work finding a proper fix for this issue.
|
||||
|
||||
This release represents **40 contributions by 5 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 [@vassudanagunta](https://github.com/vassudanagunta), [@kaushalmodi](https://github.com/kaushalmodi), and [@curttimson](https://github.com/curttimson) for their ongoing contributions.
|
||||
|
||||
And as always a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the documentation and the themes site in pristine condition.
|
||||
|
||||
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
|
||||
which has received **24 contributions by 8 contributors**. A special thanks to [@bep](https://github.com/bep), [@4RU](https://github.com/4RU), [@kaushalmodi](https://github.com/kaushalmodi), and [@mitchchn](https://github.com/mitchchn) for their work on the documentation site.
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 23649+ [stars](https://github.com/gohugoio/hugo/stargazers)
|
||||
* 447+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
|
||||
* 197+ [themes](http://themes.gohugo.io/)
|
||||
|
||||
## Notes
|
||||
|
||||
* Hugo will now convert non-string `YAML` map keys to string. See [#4393](https://github.com/gohugoio/hugo/issues/4393) for more information. You will get a `WARNING` in the console if you are touched by this.
|
||||
* We have improved the `PNG` processing, and have incremented the version numbers on the URL for the processed `PNG` image. This will just work, but you may want to run `hugo --gc` to clean up some old stale images in the resource cache.
|
||||
|
||||
## Enhancements
|
||||
|
||||
### Templates
|
||||
|
||||
* Add template func for TOML/JSON/YAML docs examples conversion. This is mainly motivated by the needs of the Hugo docs site. [d382502d](https://github.com/gohugoio/hugo/commit/d382502d6dfa1c066545e215ba83e2e0a9d2c8d7) [@bep](https://github.com/bep) [#4389](https://github.com/gohugoio/hugo/issues/4389)
|
||||
|
||||
### Core
|
||||
|
||||
* Refactor tests for JSON, YAML and TOML equivalency, add coverage [82eefded](https://github.com/gohugoio/hugo/commit/82eefded1353f0198fd8fe9f7df1aa620d3d50eb) [@vassudanagunta](https://github.com/vassudanagunta)
|
||||
* Re-enable YAML data tests disabled in f554503f [e1728349](https://github.com/gohugoio/hugo/commit/e1728349930e2cc1b6580766473de98adb0f3e50) [@vassudanagunta](https://github.com/vassudanagunta)
|
||||
|
||||
### Other
|
||||
|
||||
* Preserve color palette for PNG images [799c654b](https://github.com/gohugoio/hugo/commit/799c654b0d39ec869c2da24d41de3636eb7157f0) [@bep](https://github.com/bep) [#4416](https://github.com/gohugoio/hugo/issues/4416)
|
||||
* Use `Floyd-Steinberg` dithering for PNGs [13ea1e7c](https://github.com/gohugoio/hugo/commit/13ea1e7c352852966f88ef119d9434bbb1ee62fa) [@bep](https://github.com/bep) [#4453](https://github.com/gohugoio/hugo/issues/4453)
|
||||
* Make `ge`, `le` etc. work with the Hugo Version number [0602135f](https://github.com/gohugoio/hugo/commit/0602135fd44b0cfa0a51b0ec6e451ae58ac95666) [@bep](https://github.com/bep) [#4443](https://github.com/gohugoio/hugo/issues/4443)
|
||||
* Update dependencies [eaf573a2](https://github.com/gohugoio/hugo/commit/eaf573a2778e79287b871b69f4959fd3082d8887) [@bep](https://github.com/bep) [#4418](https://github.com/gohugoio/hugo/issues/4418)
|
||||
* Update to Go 1.10 (!) Take 2 [a3f26e56](https://github.com/gohugoio/hugo/commit/a3f26e56368c62b0900a10d83a11b7783630963b) [@bep](https://github.com/bep)
|
||||
* Update to Go 1.10 (!) [ff10c15a](https://github.com/gohugoio/hugo/commit/ff10c15a93632043f7a7f6551a30487c9ef58c50) [@bep](https://github.com/bep)
|
||||
* Add WARNING for integer YAML keys [0816a97a](https://github.com/gohugoio/hugo/commit/0816a97a469f11d8e9706143975eaa532e29639b) [@bep](https://github.com/bep) [#4393](https://github.com/gohugoio/hugo/issues/4393)
|
||||
* Tune stringifyMapKeys [10a917df](https://github.com/gohugoio/hugo/commit/10a917dfdce8851666c5b89ebc02af6f6c84ab59) [@bep](https://github.com/bep)
|
||||
* Rename stringifyYAMLMapKeys to stringifyMapKeys [d4beef0d](https://github.com/gohugoio/hugo/commit/d4beef0d2bb8f6481fa80e1d938454a7d4e38814) [@bep](https://github.com/bep)
|
||||
* Add benchmarks for stringifyYAMLMapKeys [51213e0b](https://github.com/gohugoio/hugo/commit/51213e0be19fc19dbca9815afa95c73bd6d159c2) [@bep](https://github.com/bep)
|
||||
* Add support for `YAML` array data files [1fa24177](https://github.com/gohugoio/hugo/commit/1fa2417777d82b81bf37919ad02de4f5dcbf0d50) [@vassudanagunta](https://github.com/vassudanagunta) [#3890](https://github.com/gohugoio/hugo/issues/3890)
|
||||
* Account for array type data in data dir merge/override logic [bb549a0d](https://github.com/gohugoio/hugo/commit/bb549a0d57505a6b8f28930bb91a9ab44cbb3288) [@vassudanagunta](https://github.com/vassudanagunta) [#4366](https://github.com/gohugoio/hugo/issues/4366)
|
||||
* Add "target" and "rel" parameters to figure shortcode [2e95ec68](https://github.com/gohugoio/hugo/commit/2e95ec6844bf65a25485bdc8e2638e45788f2dcf) [@kaushalmodi](https://github.com/kaushalmodi)
|
||||
* image" property, not "twitter:image:src" [76d38d5e](https://github.com/gohugoio/hugo/commit/76d38d5e5322fc6220fb9e74f9ca0668606ebb5d) [@kaushalmodi](https://github.com/kaushalmodi)
|
||||
|
||||
## Fixes
|
||||
|
||||
### Core
|
||||
|
||||
* Continue `GitInfo` lookup on error [e9750d83](https://github.com/gohugoio/hugo/commit/e9750d831f749afa928d8a099af5889d18cb2484) [@bep](https://github.com/bep)
|
||||
* Fix paginator `URL` for sections with URL in front matter [9f740b37](https://github.com/gohugoio/hugo/commit/9f740b37cfb3278e34a5d085380ccd4d619dabff) [@bep](https://github.com/bep) [#4415](https://github.com/gohugoio/hugo/issues/4415)
|
||||
|
||||
### Other
|
||||
|
||||
* Fix bug in Site.assembleSections method [00868081](https://github.com/gohugoio/hugo/commit/00868081f624928d773a7b698654766f8cd70069) [@vassudanagunta](https://github.com/vassudanagunta) [#4447](https://github.com/gohugoio/hugo/issues/4447)
|
||||
* Update Blackfriday to fix footnote HTML5 validation error [492fea7c](https://github.com/gohugoio/hugo/commit/492fea7cd2bfcbdfe9f56aa0ae659cf62648833b) [@bep](https://github.com/bep) [#4433](https://github.com/gohugoio/hugo/issues/4433)
|
||||
* Fix `YAML` maps key type [16a5c745](https://github.com/gohugoio/hugo/commit/16a5c74519771138023f019fe535fa5b250dc50d) [@dmgawel](https://github.com/dmgawel) [#2441](https://github.com/gohugoio/hugo/issues/2441)
|
||||
* Remove `ERROR` on missing baseURL [55bd46a6](https://github.com/gohugoio/hugo/commit/55bd46a633d68f62e131457631ba839d6f876a55) [@bep](https://github.com/bep) [#4397](https://github.com/gohugoio/hugo/issues/4397)
|
||||
|
||||
|
||||
|
||||
|
||||
|
20
content/news/0.37.1-relnotes/index.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
---
|
||||
date: 2018-03-07
|
||||
title: "Hugo 0.37.1: One Bugfix"
|
||||
description: "Fixes SVG (and similar) handling as page resources."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
This is a bug-fix release with a one important fix:
|
||||
|
||||
Image content such as `SVG` cannot be scaled with the built-in image processing methods, but it should still be possible to use them as page resources. This was a regression in Hugo `0.37` and is now fixed. [ba94abbf](https://github.com/gohugoio/hugo/commit/ba94abbf5dd90f989242af8a7027d67a572a6128) [@bep](https://github.com/bep) [#4455](https://github.com/gohugoio/hugo/issues/4455)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
3
content/showcase/small-multiples/bio.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
Small Multiples is a multidisciplinary team of data specialists, designers and developers that help people make the best use of their data, a journey that starts from strategy, to concepts, mock-ups, prototypes, design, and development.
|
||||
|
BIN
content/showcase/small-multiples/featured-small-multiples.png
Normal file
After Width: | Height: | Size: 366 KiB |
47
content/showcase/small-multiples/index.md
Normal file
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
|
||||
title: Small Multiples
|
||||
date: 2018-02-28
|
||||
description: "\"Hugo has excellent support and integration with Netlify and we were immediately blown away by how fast it was.\""
|
||||
siteURL: https://smallmultiples.com.au/
|
||||
byline: "[Small Multiples](https://smallmultiples.com.au/)"
|
||||
draft: true
|
||||
---
|
||||
|
||||
Previously we had built and hosted our website with SquareSpace. Although SquareSpace was adequate for quickly showcasing our work, we felt it didn’t reflect our technical capabilities and the types of products we build for our clients.
|
||||
|
||||
For many client applications, static front-end sites provide fast, scalable solutions that can easily connect with any back-end service, API or static data. We wanted to use the same processes and infrastructure that we use to host and deploy many of our products, so we felt that building a static site was the right solution for our website.
|
||||
|
||||
Netlify is a hosting and deployment service that we use for many products. Our developers really like it because it has strong integration with GitHub and it works with the build tools we use such as Yarn and Webpack. It creates a production build every time we commit to our GitHub repository. This means we can share and preview every change internally or with clients.
|
||||
|
||||
Application development has become increasingly complex and there is a strong motivation to simplify this process by avoiding complicated backends in favour of applications that consume static data and APIs (a JAMstack).
|
||||
|
||||
Libraries like React make this easy, but we also wanted something that was server rendered. This led us to look at React based tools for static site generation such as GatsbyJS. We liked GatsbyJS, but in the end, we didn’t choose it due to the lack of availability of a simple CMS driven data source.
|
||||
|
||||
For this, we considered Contentful. Contentful is a beautifully designed application. It’s basically a headless CMS, but it’s not specifically designed for websites and it becomes quite expensive at a commercial level. Their free tier is possibly a good option for personal sites especially with Gatsby. We also evaluated prose.io. This is a free service for editing markdown files in a GitHub repository. It works well, but it’s quite basic and didn’t provide the editing experience we were looking for.
|
||||
|
||||
At the same time, we started exploring Hugo. Hugo is a static site generator similar to Jekyll, but it’s written in Go. It has excellent support and integration with Netlify and we were immediately blown away by how fast it was.
|
||||
|
||||
We had been closely following the redevelopment of the Smashing Magazine website. We knew this was being powered by Hugo and Netlify and this showed us that Hugo could work for a large scale sites.
|
||||
|
||||
The deciding factor, however, was the availability of CMS options that integrate well with Hugo. Netlify has an open source project called NetlifyCMS and there are also hosted services like Forestry.io. These both provide a CMS with an editing interface for markdown files and images. There is no database, instead, changes are committed directly back into the GitHub repository.
|
||||
|
||||
In the end, we chose Hugo on Netlify, with Forestry as our CMS. The site is built and redeployed immediately with Netlify watching for changes to the GitHub repository.
|
||||
|
||||
Was this the right choice? For us, yes, but we learnt a few things along the way.
|
||||
|
||||
The Hugo templating language was very powerful, although also frustrating at times. The queries used to filter list pages are concise but difficult to read. Although it’s easy to get started, Hugo can have a significant learning curve as you try to do more complicated things.
|
||||
|
||||
Hugo has particular expectations when it comes to CMS concepts like tags, categories, RSS, related content and menus. Some parts of our initial design did not match perfectly with how these work in Hugo. It took some time to figure out how to make things work the way we wanted without losing all the benefits of structured content.
|
||||
|
||||
There were a few teething issues. We picked some relatively new technologies and as a result, we encountered some bugs. We were forced to find some workarounds and logged some issues with Hugo during the course of development. Most of these were fixed and features were added with releases happening frequently over the time we were working on the project. This can be exciting but also frustrating. We can see Hugo is developing in the right direction.
|
||||
|
||||
NetlifyCMS was also very new when we first looked at it and this is partly why we opted for Forestry. Forestry is an excellent choice for an out-of-the-box CMS and it needs very little code configuration. It provided a better editing experience for non-technical users. I would still say this is true, but it also provides fewer options for customisation when compared with NetlifyCMS.
|
||||
|
||||
Fortunately, the site is more portable now than it was, or would have been with a dynamic CMS like WordPress, or a fully hosted service like SquareSpace. It should be comparatively easy to swap the publishing functions from Forestry to NetlifyCMS or to change the templates. No part of the pipe-line is tightly coupled, the hosting, the CMS and the templates and the build process can all be updated independently, without changing anything else.
|
||||
|
||||
We have complete control over the design and mark-up produced. This means we can implement a better responsive design and have a stronger focus on accessibility and performance.
|
||||
|
||||
These technology choices gave us a good performance baseline. It was important to implement a site that took advantage of this. As a data visualisation agency, it can be difficult to optimise for performance with a small bundle size, while also aiming for high-quality visuals and working with large datasets. This meant we spent a lot of time optimising assets making sure there was little blocking the critical path for faster rendering and lazy-load images and videos.
|
||||
|
||||
The end result is a high performance site. We think this could have been achieved with GatsbyJS, Hugo or any another static site generator. However, what was important was the decision to use static infrastructure for speed, security, flexibility and hopefully a better ongoing development experience. If you are looking at choosing a static site generator or wondering whether a static is the right choice for you, we hope this has helped.
|
|
@ -81,7 +81,7 @@ You can now render the list of recordings for all the bass players in a template
|
|||
{{ end }}
|
||||
```
|
||||
|
||||
And then in the `partial/artist.html`:
|
||||
And then in the `partials/artist.html`:
|
||||
|
||||
```
|
||||
<ul>
|
||||
|
|
|
@ -43,15 +43,7 @@ The idea of a list page comes from the [hierarchical mental model of the web][me
|
|||
|
||||
Since section lists and taxonomy lists (N.B., *not* [taxonomy terms lists][taxterms]) are both *lists* with regards to their templates, both have the same terminating default of `_default/list.html` or `themes/<THEME>/layouts/_default/list.html` in their lookup order. In addition, both [section lists][sectiontemps] and [taxonomy lists][taxlists] have their own default list templates in `_default`:
|
||||
|
||||
#### Default Section Templates
|
||||
|
||||
1. `layouts/_default/section.html`
|
||||
2. `layouts/_default/list.html`
|
||||
|
||||
#### Default Taxonomy List Templates
|
||||
|
||||
1. `layouts/_default/taxonomy.html`
|
||||
2. `themes/<THEME>/layouts/_default/taxonomy.html`
|
||||
See [Template Lookup Order](/templates/lookup-order/) for the complete reference.
|
||||
|
||||
## Add Content and Front Matter to List Pages
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ toc: true
|
|||
|
||||
## RSS Template Lookup Order
|
||||
|
||||
See [Template Lookup](/templates/lookup-order/).
|
||||
See [Template Lookup Order](/templates/lookup-order/) for the complete reference.
|
||||
|
||||
{{% note "Hugo Ships with an RSS Template" %}}
|
||||
Hugo ships with its own [RSS 2.0 template](#the-embedded-rss-xml). The embedded template will be sufficient for most use cases.
|
||||
|
@ -36,27 +36,9 @@ Hugo provides the ability for you to define any RSS type you wish and can have d
|
|||
|
||||
## Lookup Order for RSS Templates
|
||||
|
||||
### Main RSS
|
||||
The table below shows the RSS template lookup order for the different page kinds. The first listing shows the lookup order when running with a theme (`demoTheme`).
|
||||
|
||||
1. `/layouts/rss.xml`
|
||||
2. `/layouts/_default/rss.xml`
|
||||
3. Embedded rss.xml
|
||||
|
||||
### Section RSS
|
||||
|
||||
1. `/layouts/section/<SECTION>.rss.xml`
|
||||
2. `/layouts/_default/rss.xml`
|
||||
3. `/themes/<THEME>/layouts/section/<SECTION>.rss.xml`
|
||||
4. `/themes/<THEME>/layouts/_default/rss.xml`
|
||||
5. Embedded rss.xml
|
||||
|
||||
### Taxonomy RSS
|
||||
|
||||
1. `/layouts/taxonomy/<SINGULAR>.rss.xml`
|
||||
2. `/layouts/_default/rss.xml`
|
||||
3. `/themes/<THEME>/layouts/taxonomy/<SINGULAR>.rss.xml`
|
||||
4. `/themes/<THEME>/layouts/_default/rss.xml`
|
||||
5. Embedded rss.xml
|
||||
{{< datatable-filtered "output" "layouts" "OutputFormat == RSS" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
|
||||
|
||||
## Configure RSS
|
||||
|
||||
|
@ -64,7 +46,7 @@ By default, Hugo will create an unlimited number of RSS entries. You can limit t
|
|||
|
||||
The following values will also be included in the RSS output if specified in your site’s configuration:
|
||||
|
||||
```
|
||||
```toml
|
||||
languageCode = "en-us"
|
||||
copyright = "This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License."
|
||||
|
||||
|
@ -76,7 +58,7 @@ copyright = "This work is licensed under a Creative Commons Attribution-ShareAli
|
|||
|
||||
This is the default RSS template that ships with Hugo. It adheres to the [RSS 2.0 Specification][RSS 2.0].
|
||||
|
||||
```
|
||||
```xml
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
|
@ -114,26 +96,24 @@ Hugo will automatically add the following header line to this file on render. Pl
|
|||
|
||||
## Reference your RSS Feed in `<head>`
|
||||
|
||||
In your `header.html` template, you can specify your RSS feed in your `<head></head>` tag like this:
|
||||
In your `header.html` template, you can specify your RSS feed in your `<head></head>` tag using Hugo's [Output Formats][Output Formats] like this:
|
||||
|
||||
```
|
||||
{{ if .RSSLink }}
|
||||
<link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
|
||||
<link href="{{ .RSSLink }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}" />
|
||||
{{ end }}
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}" title="{{ $.Site.Title }}">
|
||||
{{ end -}}
|
||||
```
|
||||
|
||||
...with the auto-discovery link specified by the line with `rel="alternate"`.
|
||||
|
||||
The `.RSSLink` will render the appropriate RSS feed URL for the section, whether it's everything, posts in a section, or a taxonomy.
|
||||
|
||||
If you reference your RSS link, be sure to specify the MIME type with `type="application/rss+xml"`.
|
||||
If you only want the RSS link, you can query the formats:
|
||||
|
||||
```
|
||||
<a href="{{ .URL }}" type="application/rss+xml" target="_blank">{{ .SomeText }}</a>
|
||||
{{ with .OutputFormats.Get "rss" -}}
|
||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}" title="{{ $.Site.Title }}">
|
||||
{{ end -}
|
||||
```
|
||||
|
||||
[config]: /getting-started/configuration/
|
||||
[embedded]: #the-embedded-rss-xml
|
||||
[RSS 2.0]: http://cyber.law.harvard.edu/rss/rss.html "RSS 2.0 Specification"
|
||||
[section]: /content-management/sections/
|
||||
[Output Formats]: /templates/output-formats/#link-to-output-formats
|
|
@ -20,10 +20,10 @@ 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.
|
||||
|
||||
* [Hugoidx](https://github.com/blevesearch/hugoidx) is an experimental application to create a search index. It's built on top of [Bleve](http://www.blevesearch.com/).
|
||||
* [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-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 seperate 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!
|
||||
|
||||
## Commercial Search Services
|
||||
|
||||
|
|
|
@ -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 %}}
|
||||
|
||||
## Can I set configuration variables via OS environment?
|
||||
|
||||
Yes you can! See [Configure with Environment Variables](/getting-started/configuration/#configure-with-environment-variables).
|
||||
|
||||
## How do I schedule posts?
|
||||
|
||||
1. Set `publishDate` in the page [Front Matter](/content-management/front-matter/) to a date in the future.
|
||||
|
@ -34,4 +38,3 @@ Also see this Twitter thread:
|
|||
## 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).
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ toc: true
|
|||
For example, the following fields would be available in `layouts/_defaults/terms.html`, depending on how you organize your [taxonomy templates][taxonomytemplates]:
|
||||
|
||||
.Data.Singular
|
||||
: The singular name of the taxonomy (e.g., `tags => `tag`)
|
||||
: The singular name of the taxonomy (e.g., `tags => tag`)
|
||||
|
||||
.Data.Plural
|
||||
: The plural name of the taxonomy (e.g., `tags => tags`)
|
||||
|
@ -49,7 +49,7 @@ Note that `.Data.Terms.Alphabetical` and `.Data.Terms.ByCount` can also be rever
|
|||
|
||||
## Use `.Site.Taxonomies` Outside of Taxonomy Templates
|
||||
|
||||
The `.Site.Taxonomies` variable holds all the taxonomies defined site-wide. `.Site.Taxonomies` is a map of the taxonomy name to a list of its values (e.g., `"tags" -> ["tag1", "tag2", "tag3"]``). Each value, though, is not a string but rather a *Taxonomy variable*.
|
||||
The `.Site.Taxonomies` variable holds all the taxonomies defined site-wide. `.Site.Taxonomies` is a map of the taxonomy name to a list of its values (e.g., `"tags" -> ["tag1", "tag2", "tag3"]`). Each value, though, is not a string but rather a *Taxonomy variable*.
|
||||
|
||||
## The `.Taxonomy` Variable
|
||||
|
||||
|
|
190
data/docs.json
|
@ -297,12 +297,6 @@
|
|||
"OutputFormat": "HTML",
|
||||
"Suffix": "html",
|
||||
"Template Lookup Order": [
|
||||
"layouts/page/index.html.html",
|
||||
"layouts/page/home.html.html",
|
||||
"layouts/page/list.html.html",
|
||||
"layouts/page/index.html",
|
||||
"layouts/page/home.html",
|
||||
"layouts/page/list.html",
|
||||
"layouts/index.html.html",
|
||||
"layouts/home.html.html",
|
||||
"layouts/list.html.html",
|
||||
|
@ -349,14 +343,6 @@
|
|||
"OutputFormat": "HTML",
|
||||
"Suffix": "html",
|
||||
"Template Lookup Order": [
|
||||
"layouts/page/demolayout.html.html",
|
||||
"layouts/page/index.html.html",
|
||||
"layouts/page/home.html.html",
|
||||
"layouts/page/list.html.html",
|
||||
"layouts/page/demolayout.html",
|
||||
"layouts/page/index.html",
|
||||
"layouts/page/home.html",
|
||||
"layouts/page/list.html",
|
||||
"layouts/demolayout.html.html",
|
||||
"layouts/index.html.html",
|
||||
"layouts/home.html.html",
|
||||
|
@ -381,18 +367,6 @@
|
|||
"OutputFormat": "HTML",
|
||||
"Suffix": "html",
|
||||
"Template Lookup Order": [
|
||||
"layouts/page/index.html.html",
|
||||
"demoTheme/layouts/page/index.html.html",
|
||||
"layouts/page/home.html.html",
|
||||
"demoTheme/layouts/page/home.html.html",
|
||||
"layouts/page/list.html.html",
|
||||
"demoTheme/layouts/page/list.html.html",
|
||||
"layouts/page/index.html",
|
||||
"demoTheme/layouts/page/index.html",
|
||||
"layouts/page/home.html",
|
||||
"demoTheme/layouts/page/home.html",
|
||||
"layouts/page/list.html",
|
||||
"demoTheme/layouts/page/list.html",
|
||||
"layouts/index.html.html",
|
||||
"demoTheme/layouts/index.html.html",
|
||||
"layouts/home.html.html",
|
||||
|
@ -425,18 +399,6 @@
|
|||
"OutputFormat": "AMP",
|
||||
"Suffix": "html",
|
||||
"Template Lookup Order": [
|
||||
"layouts/page/index.fr.amp.html",
|
||||
"layouts/page/home.fr.amp.html",
|
||||
"layouts/page/list.fr.amp.html",
|
||||
"layouts/page/index.amp.html",
|
||||
"layouts/page/home.amp.html",
|
||||
"layouts/page/list.amp.html",
|
||||
"layouts/page/index.fr.html",
|
||||
"layouts/page/home.fr.html",
|
||||
"layouts/page/list.fr.html",
|
||||
"layouts/page/index.html",
|
||||
"layouts/page/home.html",
|
||||
"layouts/page/list.html",
|
||||
"layouts/index.fr.amp.html",
|
||||
"layouts/home.fr.amp.html",
|
||||
"layouts/list.fr.amp.html",
|
||||
|
@ -469,12 +431,6 @@
|
|||
"OutputFormat": "JSON",
|
||||
"Suffix": "json",
|
||||
"Template Lookup Order": [
|
||||
"layouts/page/index.json.json",
|
||||
"layouts/page/home.json.json",
|
||||
"layouts/page/list.json.json",
|
||||
"layouts/page/index.json",
|
||||
"layouts/page/home.json",
|
||||
"layouts/page/list.json",
|
||||
"layouts/index.json.json",
|
||||
"layouts/home.json.json",
|
||||
"layouts/list.json.json",
|
||||
|
@ -490,31 +446,136 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"Example": "RSS home",
|
||||
"Example": "RSS home with theme",
|
||||
"Kind": "home",
|
||||
"OutputFormat": "RSS",
|
||||
"Suffix": "xml",
|
||||
"Template Lookup Order": [
|
||||
"layouts/page/index.rss.xml",
|
||||
"layouts/page/home.rss.xml",
|
||||
"layouts/page/rss.xml",
|
||||
"layouts/page/list.rss.xml",
|
||||
"layouts/page/index.xml",
|
||||
"layouts/page/home.xml",
|
||||
"layouts/page/list.xml",
|
||||
"layouts/index.rss.xml",
|
||||
"demoTheme/layouts/index.rss.xml",
|
||||
"layouts/home.rss.xml",
|
||||
"demoTheme/layouts/home.rss.xml",
|
||||
"layouts/rss.xml",
|
||||
"demoTheme/layouts/rss.xml",
|
||||
"layouts/list.rss.xml",
|
||||
"demoTheme/layouts/list.rss.xml",
|
||||
"layouts/index.xml",
|
||||
"demoTheme/layouts/index.xml",
|
||||
"layouts/home.xml",
|
||||
"demoTheme/layouts/home.xml",
|
||||
"layouts/list.xml",
|
||||
"demoTheme/layouts/list.xml",
|
||||
"layouts/_default/index.rss.xml",
|
||||
"demoTheme/layouts/_default/index.rss.xml",
|
||||
"layouts/_default/home.rss.xml",
|
||||
"demoTheme/layouts/_default/home.rss.xml",
|
||||
"layouts/_default/rss.xml",
|
||||
"demoTheme/layouts/_default/rss.xml",
|
||||
"layouts/_default/list.rss.xml",
|
||||
"demoTheme/layouts/_default/list.rss.xml",
|
||||
"layouts/_default/index.xml",
|
||||
"demoTheme/layouts/_default/index.xml",
|
||||
"layouts/_default/home.xml",
|
||||
"demoTheme/layouts/_default/home.xml",
|
||||
"layouts/_default/list.xml",
|
||||
"demoTheme/layouts/_default/list.xml",
|
||||
"layouts/_internal/_default/rss.xml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Example": "RSS section posts",
|
||||
"Kind": "section",
|
||||
"OutputFormat": "RSS",
|
||||
"Suffix": "xml",
|
||||
"Template Lookup Order": [
|
||||
"layouts/posts/section.rss.xml",
|
||||
"layouts/posts/rss.xml",
|
||||
"layouts/posts/list.rss.xml",
|
||||
"layouts/posts/section.xml",
|
||||
"layouts/posts/list.xml",
|
||||
"layouts/section/section.rss.xml",
|
||||
"layouts/section/rss.xml",
|
||||
"layouts/section/list.rss.xml",
|
||||
"layouts/section/section.xml",
|
||||
"layouts/section/list.xml",
|
||||
"layouts/_default/section.rss.xml",
|
||||
"layouts/_default/rss.xml",
|
||||
"layouts/_default/list.rss.xml",
|
||||
"layouts/_default/index.xml",
|
||||
"layouts/_default/home.xml",
|
||||
"layouts/_default/section.xml",
|
||||
"layouts/_default/list.xml",
|
||||
"layouts/_internal/_default/rss.xml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Example": "Taxonomy list in categories",
|
||||
"Kind": "taxonomy",
|
||||
"OutputFormat": "RSS",
|
||||
"Suffix": "xml",
|
||||
"Template Lookup Order": [
|
||||
"layouts/categories/category.rss.xml",
|
||||
"layouts/categories/taxonomy.rss.xml",
|
||||
"layouts/categories/rss.xml",
|
||||
"layouts/categories/list.rss.xml",
|
||||
"layouts/categories/category.xml",
|
||||
"layouts/categories/taxonomy.xml",
|
||||
"layouts/categories/list.xml",
|
||||
"layouts/taxonomy/category.rss.xml",
|
||||
"layouts/taxonomy/taxonomy.rss.xml",
|
||||
"layouts/taxonomy/rss.xml",
|
||||
"layouts/taxonomy/list.rss.xml",
|
||||
"layouts/taxonomy/category.xml",
|
||||
"layouts/taxonomy/taxonomy.xml",
|
||||
"layouts/taxonomy/list.xml",
|
||||
"layouts/category/category.rss.xml",
|
||||
"layouts/category/taxonomy.rss.xml",
|
||||
"layouts/category/rss.xml",
|
||||
"layouts/category/list.rss.xml",
|
||||
"layouts/category/category.xml",
|
||||
"layouts/category/taxonomy.xml",
|
||||
"layouts/category/list.xml",
|
||||
"layouts/_default/category.rss.xml",
|
||||
"layouts/_default/taxonomy.rss.xml",
|
||||
"layouts/_default/rss.xml",
|
||||
"layouts/_default/list.rss.xml",
|
||||
"layouts/_default/category.xml",
|
||||
"layouts/_default/taxonomy.xml",
|
||||
"layouts/_default/list.xml",
|
||||
"layouts/_internal/_default/rss.xml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Example": "Taxonomy terms in categories",
|
||||
"Kind": "taxonomyTerm",
|
||||
"OutputFormat": "RSS",
|
||||
"Suffix": "xml",
|
||||
"Template Lookup Order": [
|
||||
"layouts/categories/category.terms.rss.xml",
|
||||
"layouts/categories/terms.rss.xml",
|
||||
"layouts/categories/rss.xml",
|
||||
"layouts/categories/list.rss.xml",
|
||||
"layouts/categories/category.terms.xml",
|
||||
"layouts/categories/terms.xml",
|
||||
"layouts/categories/list.xml",
|
||||
"layouts/taxonomy/category.terms.rss.xml",
|
||||
"layouts/taxonomy/terms.rss.xml",
|
||||
"layouts/taxonomy/rss.xml",
|
||||
"layouts/taxonomy/list.rss.xml",
|
||||
"layouts/taxonomy/category.terms.xml",
|
||||
"layouts/taxonomy/terms.xml",
|
||||
"layouts/taxonomy/list.xml",
|
||||
"layouts/category/category.terms.rss.xml",
|
||||
"layouts/category/terms.rss.xml",
|
||||
"layouts/category/rss.xml",
|
||||
"layouts/category/list.rss.xml",
|
||||
"layouts/category/category.terms.xml",
|
||||
"layouts/category/terms.xml",
|
||||
"layouts/category/list.xml",
|
||||
"layouts/_default/category.terms.rss.xml",
|
||||
"layouts/_default/terms.rss.xml",
|
||||
"layouts/_default/rss.xml",
|
||||
"layouts/_default/list.rss.xml",
|
||||
"layouts/_default/category.terms.xml",
|
||||
"layouts/_default/terms.xml",
|
||||
"layouts/_default/list.xml",
|
||||
"layouts/_internal/_default/rss.xml"
|
||||
]
|
||||
|
@ -787,7 +848,12 @@
|
|||
"Aliases": [
|
||||
"ge"
|
||||
],
|
||||
"Examples": []
|
||||
"Examples": [
|
||||
[
|
||||
"{{ if ge .Hugo.Version \"0.36\" }}Reasonable new Hugo version!{{ end }}",
|
||||
"Reasonable new Hugo version!"
|
||||
]
|
||||
]
|
||||
},
|
||||
"Gt": {
|
||||
"Description": "Gt returns the boolean truth of arg1 \u003e arg2.",
|
||||
|
@ -2238,6 +2304,20 @@
|
|||
"Hello world, gophers!"
|
||||
]
|
||||
]
|
||||
},
|
||||
"Remarshal": {
|
||||
"Description": "Remarshal is used in the Hugo documentation to convert configuration\nexamples from YAML to JSON, TOML (and possibly the other way around).\nThe is primarily a helper for the Hugo docs site.\nIt is not a general purpose YAML to TOML converter etc., and may\nchange without notice if it serves a purpose in the docs.\nFormat is one of json, yaml or toml.",
|
||||
"Args": [
|
||||
"format",
|
||||
"data"
|
||||
],
|
||||
"Aliases": null,
|
||||
"Examples": [
|
||||
[
|
||||
"{{ \"title = \\\"Hello World\\\"\" | transform.Remarshal \"json\" | safeHTML }}",
|
||||
"{\n \"title\": \"Hello World\"\n}\n"
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"urls": {
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
{{ $file := .Get "file" }}
|
||||
{{ $isHTML := strings.HasSuffix $file "html" }}
|
||||
{{ $.Scratch.Set "codeLang" "" }}
|
||||
{{ $suffix := findRE "(\\.[^.]+)$" $file 1 }}
|
||||
{{ with $suffix }}
|
||||
{{ $.Scratch.Set "codeLang" (index . 0 | strings.TrimPrefix ".") }}
|
||||
{{ end }}
|
||||
{{ with .Get "codeLang" }}{{ $.Scratch.Set "codeLang" . }}{{ end }}
|
||||
<div class="code relative" id="{{ $file | urlize}}">
|
||||
{{- with $file -}}
|
||||
<div class="filename san-serif f6 dib lh-solid pl2 pv2">{{.}}</div>
|
||||
|
@ -11,7 +16,7 @@
|
|||
{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
|
||||
{{end}}
|
||||
<div class="code-copy-content nt3" {{with .Get "download"}}id="{{.}}"{{end}}>
|
||||
{{ if .Get "nocode" }}{{ .Inner }}{{ else }}{{ if $isHTML }}{{- highlight .Inner "html" "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}{{ end }}
|
||||
{{ if .Get "nocode" }}{{ $.Inner }}{{ else }}{{ with $.Scratch.Get "codeLang" }}{{- highlight $.Inner . "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}{{ end }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
|||
command = "hugo"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.36.1"
|
||||
HUGO_VERSION = "0.37.1"
|
||||
HUGO_ENV = "production"
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
||||
|
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
|||
command = "hugo --enableGitInfo"
|
||||
|
||||
[context.split1.environment]
|
||||
HUGO_VERSION = "0.36.1"
|
||||
HUGO_VERSION = "0.37.1"
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "hugo -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.36.1"
|
||||
HUGO_VERSION = "0.37.1"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "hugo -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_VERSION = "0.36.1"
|
||||
HUGO_VERSION = "0.37.1"
|
||||
|
||||
[context.next.environment]
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 148 KiB |
After Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 176 KiB |
After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 283 KiB |
After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 140 KiB |
Before Width: | Height: | Size: 463 KiB |
After Width: | Height: | Size: 276 KiB |
Before Width: | Height: | Size: 206 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 165 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 274 KiB |
After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 127 KiB |
Before Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 183 KiB |
After Width: | Height: | Size: 95 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 15 KiB |
|
@ -5,9 +5,9 @@ logo = "/images/sponsors/forestry-logotype.svg"
|
|||
copy = ""
|
||||
|
||||
[[banners]]
|
||||
name = ""
|
||||
link = ""
|
||||
logo = ""
|
||||
name = "Linode"
|
||||
link = "https://www.linode.com/"
|
||||
logo = "/images/sponsors/linode-logo_standard_light_medium.png"
|
||||
copy = ""
|
||||
|
||||
[[banners]]
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ . }}');
|
||||
{{ $site := $.Site.BaseURL | replaceRE "^https?://(www\\.)?([^/]+).*" "$2" }}
|
||||
gtag('config', '{{ . }}', {'dimension1': '{{ $site }}', 'dimension2': '{{ getenv "BRANCH" }}'});
|
||||
|
||||
/**
|
||||
* Function that tracks a click on an outbound link in Analytics.
|
||||
|
@ -13,7 +14,6 @@
|
|||
* using 'navigator.sendBeacon' in browser that support it.
|
||||
*/
|
||||
var trackOutboundLink = function(id, url) {
|
||||
console.log("track:", id, url)
|
||||
gtag('event', 'click', {
|
||||
'event_category': 'outbound',
|
||||
'event_label': id,
|
||||
|
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 30 KiB |