Merge commit '45e6fdb315d113ba13e20a633ed0c67e3f25170d'
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 13 Dec 2021 20:05:10 +0000 (21:05 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 13 Dec 2021 20:05:10 +0000 (21:05 +0100)
28 files changed:
1  2 
docs/.gitignore
docs/.markdownlint.yaml
docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/opengraph/gohugoio-card-base-1.png
docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/opengraph/mulish-black.ttf
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/baseof.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/docs/page-meta-data.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/nav-links-docs-mobile.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/nav-links-global-mobile.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/nav-mobile.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/opengraph/get-featured-image.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/opengraph/opengraph.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/opengraph/twitter_cards.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/site-footer.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/layouts/partials/site-search.html
docs/_vendor/github.com/gohugoio/gohugoioTheme/package.json
docs/_vendor/modules.txt
docs/config/_default/config.toml
docs/content/en/content-management/multilingual.md
docs/content/en/contribute/development.md
docs/content/en/featured.png
docs/content/en/functions/images/index.md
docs/content/en/hugo-pipes/introduction.md
docs/content/en/templates/introduction.md
docs/content/en/templates/lists.md
docs/go.mod
docs/go.sum
docs/layouts/shortcodes/code-toggle.html
docs/netlify.toml

diff --cc docs/.gitignore
index bad85a189035d3f47c47b7b9850c4d546f7d404f,0000000000000000000000000000000000000000..4164d21f8d1203d750b7d15721c036268a5f0de4
mode 100644,000000..100644
--- /dev/null
@@@ -1,7 -1,0 +1,9 @@@
 +/.idea
++/.vscode
 +/public
 +node_modules
 +nohup.out
 +.DS_Store
 +trace.out
 +.hugo_build.lock
++resources/_gen/images/
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..1b76d280ecadde37c599fdb40b9bb565498bffc3
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,4 @@@
++# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
++
++MD013: false  # Line length
++MD033: false  # Inline HTML
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..65555845bf5822ceb6dc06a3ef04850ad5e434dd
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..db680a088a13b2a8ec3aaff424d1c7ed4d8bfdbe
new file mode 100644 (file)
Binary files differ
index 0de21a255e09cae5139674f3a6aeb6da61b232de,0000000000000000000000000000000000000000..47019072c2dce0dfc5b6f7a172be00375d128fdc
mode 100644,000000..100644
--- /dev/null
@@@ -1,71 -1,0 +1,71 @@@
-   {{- template "_internal/opengraph.html" . -}}
 +<!DOCTYPE html>
 +<html class="no-js" lang="{{ with $.Site.LanguageCode }}{{ . }}{{ else }}en-us{{ end }}">
 +
 +<head>
 +  <meta charset="utf-8">
 +  {{/* https://www.zachleat.com/web/preload/ */}}
 +  <link rel="preload" href="{{ "fonts/muli-latin-200.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
 +  <link rel="preload" href="{{ "fonts/muli-latin-400.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
 +  <link rel="preload" href="{{ "fonts/muli-latin-800.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
 +
 +  <meta http-equiv="X-UA-Compatible" content="IE=edge">
 +  {{/* NOTE: the Site's title, and if there is a page title, that is set too */}}
 +  <title>{{ block "title" . }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
 +
 +  <meta name="viewport" content="width=device-width,minimum-scale=1">
 +  {{ hugo.Generator }}
 +
 +  {{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production")  }}
 +  <meta name="robots" content="index, follow">
 +  {{ else }}
 +  <meta name="robots" content="noindex, nofollow">
 +  {{ end }}
 +
 +  {{ range .AlternativeOutputFormats -}}
 +  <link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
 +  {{ end -}}
 +
 +  {{ $isDev := eq hugo.Environment "development" }}
 +  {{ $stylesheet := resources.Get "output/css/app.css"  }}
 +  {{ if not $isDev }}
 +  {{ $stylesheet = $stylesheet | minify | fingerprint }}
 +  {{ end }}
 +  {{ with $stylesheet }}
 +  {{ if $isDev }}
 +  <link rel="stylesheet" href="{{ .RelPermalink }}" crossorigin="anonymous">
 +  {{ else }}
 +  <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
 +  {{ end }}
 +  {{ $.Scratch.Set "stylesheet" . }}
 +  {{end}}
 +
 +  <meta name="description"
 +  content="{{ with .Description }}{{ . }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}">
 +
 +  {{ block "scripts" . }}
 +  {{- partial "site-scripts.html" . -}}
 +  {{ end }}
 +  {{ partial "site-manifest.html" . }}
 +  {{- partial "head-additions.html" . -}}
-   {{- template "_internal/twitter_cards.html" . -}}
++  {{- partial "opengraph/opengraph.html" . -}}
 +  {{- template "_internal/schema.html" . -}}
++  {{- partial "opengraph/twitter_cards.html" . -}}
 +
 +  {{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production")  }}
 +  {{ partial "gtag" . }}
 +  {{ end }}
 +
 +</head>
 +
 +<body class="ma0 sans-serif bg-primary-color-light{{ with getenv "HUGO_ENV" }} {{ . }}{{ end }}">
 +  {{ block "nav" . }}{{ partial "site-nav.html" . }}{{ end }}
 +  {{ block "header" . }}{{ end }}
 +  <main role="main" class="content-with-sidebar min-vh-100 pb7 pb0-ns">
 +    {{ block "main" . }}{{ end }}
 +  </main>
 +
 +  {{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }}
 +
 +</body>
 +
 +</html>
index 8b3fbbafc339b0b74c4adaeb18119bf8921867ee,0000000000000000000000000000000000000000..dc8ddd01e095484d4507329bdb7f912ac45804c2
mode 100644,000000..100644
--- /dev/null
@@@ -1,6 -1,0 +1,3 @@@
- <h6 class="f4 dark-gray mb2">
-   <a href="{{ .Permalink }}" class="hide-child link primary-color">
-   <span class="nl3 child">{{ partial "svg/link-permalink.svg" (dict "size" "14px") }}</span>
-     “{{ .Title }}”
-   </a> was last updated: {{ .Lastmod.Format "January 2, 2006" }}{{ with .GitInfo }}: <a class="hide-child link primary-color" href="{{$.Site.Params.ghrepo}}commit/{{ .Hash }}">{{ .Subject }} ({{ .AbbreviatedHash }})</a>{{end }}
++<h6 class="f6 dark-gray mb2">
++  Last updated: {{ .Lastmod.Format "January 2, 2006" }}{{ with .GitInfo }}: <a class="hide-child link primary-color" href="{{$.Site.Params.ghrepo}}commit/{{ .Hash }}">{{ .Subject }} ({{ .AbbreviatedHash }})</a>{{end }}
 +</h6>
index ad9d535b461c8510743d8caea9c31c152e96e323,0000000000000000000000000000000000000000..a8fc27e21595b0e6dd1edcb038cc39807ef7de4d
mode 100644,000000..100644
--- /dev/null
@@@ -1,11 -1,0 +1,11 @@@
- <ul class="list dib ph0 ma0 scrolling-touch tc">
 +{{ $currentPage := . }}
 +{{ $menu := .Site.Menus.docs.ByWeight }}
++<ul class="list dib ph0 scrolling-touch tc">
 +  {{ range $menu }}{{ $post := printf "%s" .Post }}
 +    <li  class="tl dib ma0 hover-bg-black w-100{{ if eq $post "break" }} mb2 bb b--mid-gray{{ end }}">
 +        <a href="{{.URL}}" class="ttu f6 link primary-color-light  hover-white db brand-font mb1  ma0 w-100 pv2 ph4{{if $currentPage.IsMenuCurrent "main" . }} bg-primary-color{{end}}">
 +          {{ .Name }}
 +        </a>
 +    </li>
 +  {{end}}
 +</ul>
index 4a1631d9602e5515d2f42a1f3d36bc2b45edea0e,0000000000000000000000000000000000000000..6ad98923e4718a5a1e2aba286cfb72273f18debd
mode 100644,000000..100644
--- /dev/null
@@@ -1,11 -1,0 +1,11 @@@
- <ul class="list hidden dib ph0 ma0 scrolling-touch tc">
 +{{ $currentPage := . }}
 +{{ $menu := .Site.Menus.global }}
++<ul class="list hidden dib ph0 scrolling-touch tc">
 +  {{ range $menu }}
 +    <li  class="tl dib ma0 hover-bg-black w-100">
 +        <a href="{{.URL}}" class="ttu f6 link primary-color-light overflow hover-white db brand-font  ma0 w-100 pv3 ph4{{if $currentPage.IsMenuCurrent "main" . }} bg-primary-color{{end}}">
 +          {{ .Name }}
 +        </a>
 +    </li>
 +  {{end}}
 +</ul>
index 00b1a691cb6bf3132f6025191b99e4689059eebe,0000000000000000000000000000000000000000..b04866e524b373999b9a67cc00467d55e6a75a70
mode 100644,000000..100644
--- /dev/null
@@@ -1,12 -1,0 +1,12 @@@
- <div  class="globalmenu mobilemenu pb3 dn">
++<div  class="globalmenu mobilemenu pb1 dn">
 +    {{ partial "nav-links-global-mobile.html" . }}
 +</div>
- <div  class="docsmenu mobilemenu pb3 dn">
++<div  class="docsmenu mobilemenu pb1 dn">
 +    {{ partial "nav-links-docs-mobile.html" . }}
 +</div>
 +
 +<div class="flex dn-l justify-between">
-   <button class="js-toggle flex-auto dib dn-l f6 tc db mt4-ns ph3 pv2 link mr2 white bg-primary-color-dark hover-bg-primary-color ba b--white-40 w-auto" data-target=".globalmenu">Menu</button>
++  <button class="js-toggle flex-auto dib dn-l f6 tc db ph3 pv2 link mr2 white bg-primary-color-dark hover-bg-primary-color ba b--white-40 w-auto" data-target=".globalmenu">Menu</button>
 +
-   <button class="js-toggle flex-auto dib dn-l f6 tc db mt4-ns ph3 pv2 link white bg-primary-color-dark hover-bg-primary-color ba b--white-40 w-auto" data-target=".docsmenu">Docs Menu</button>
++  <button class="js-toggle flex-auto dib dn-l f6 tc db ph3 pv2 link white bg-primary-color-dark hover-bg-primary-color ba b--white-40 w-auto" data-target=".docsmenu">Docs Menu</button>
 +</div>
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..79b315a443a724e637b97174b1f797f38511f984
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,24 @@@
++{{ $images := $.Resources.ByType "image" }}
++{{ $featured := $images.GetMatch "*feature*" }}
++{{ if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end }}
++{{ if not $featured }}
++    {{ $featured = resources.Get "/opengraph/gohugoio-card-base-1.png" }}
++    {{ $size := 80 }}
++    {{ $title := $.LinkTitle }}
++    {{ if gt (len $title) 20 }}
++    {{ $size = 70 }}
++    {{ end }}
++
++    {{ $text := $title }}
++                {{ $textOptions := dict 
++                    "color" "#FFF"
++                    "size" $size
++                    "lineSpacing" 10
++                    "x" 65 "y" 80
++                    "font" (resources.Get "/opengraph/mulish-black.ttf")
++                }}
++
++    {{ $featured = $featured | images.Filter (images.Text $text $textOptions) }}
++{{ end }}
++
++{{ return $featured }}
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..c8ff64889c6be4bcab1e6a3a560bd665443e322f
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,42 @@@
++<meta property="og:title" content="{{ .Title }}" />
++<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
++<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
++<meta property="og:url" content="{{ .Permalink }}" />
++
++{{- with $.Params.images -}}
++{{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}}
++{{- else -}}
++{{- $featured := partial "opengraph/get-featured-image.html" . }}
++{{- with $featured -}}
++<meta property="og:image" content="{{ $featured.Permalink }}"/>
++{{- else -}}
++{{- with $.Site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}}
++{{- end -}}
++{{- end -}}
++
++{{- if .IsPage }}
++{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
++<meta property="article:section" content="{{ .Section }}" />
++{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
++{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
++{{- end -}}
++
++{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
++{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
++{{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
++{{- with .Params.videos }}{{- range . }}
++<meta property="og:video" content="{{ . | absURL }}" />
++{{ end }}{{ end }}
++
++{{- /* If it is part of a series, link to related articles */}}
++{{- $permalink := .Permalink }}
++{{- $siteSeries := .Site.Taxonomies.series }}
++{{ with .Params.series }}{{- range $name := . }}
++  {{- $series := index $siteSeries ($name | urlize) }}
++  {{- range $page := first 6 $series.Pages }}
++    {{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
++  {{- end }}
++{{ end }}{{ end }}
++
++{{- /* Facebook Page Admin ID for Domain Insights */}}
++{{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..9d25d0315fa1c56353e9da3f4f5547c64fac859a
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,22 @@@
++{{- with $.Params.images -}}
++<meta name="twitter:card" content="summary_large_image"/>
++<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
++{{ else -}}
++{{- $featured := partial "opengraph/get-featured-image.html" . }}
++{{- with $featured -}}
++<meta name="twitter:card" content="summary_large_image"/>
++<meta name="twitter:image" content="{{ $featured.Permalink }}"/>
++{{- else -}}
++{{- with $.Site.Params.images -}}
++<meta name="twitter:card" content="summary_large_image"/>
++<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
++{{ else -}}
++<meta name="twitter:card" content="summary"/>
++{{- end -}}
++{{- end -}}
++{{- end }}
++<meta name="twitter:title" content="{{ .Title }}"/>
++<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
++{{ with .Site.Social.twitter -}}
++<meta name="twitter:site" content="@{{ . }}"/>
++{{ end -}}
index cff476788d568e2fa66555a1a4002231a6b99de7,0000000000000000000000000000000000000000..e541849960e8d3b586f04b0dd814d11bb7a87262
mode 100644,000000..100644
--- /dev/null
@@@ -1,48 -1,0 +1,48 @@@
-     <div class="bg-primary-color-dark bottom-0 left-0 right-0 dn-l fixed pb3 ph3 w-100">
 +<footer class="bg-primary-color-dark ph4-ns pt4 relative w-100" role="contentinfo">
 +    <div class="center flex-ns flex-wrap justify-between mw9 w-90">
 +      <div class="pb3 pt4 w-100 w-50-ns">
 +
 +         <div class="b f3  light-gray mb3 nested-links tc">
 +           By the <a href="https://github.com/gohugoio/hugo/graphs/contributors" class="link">Hugo Authors</a><br />
 +          </div>
 +
 +          <div class="center w4">
 +            <img src="/images/hugo-logo-wide.svg" alt="Hugo Logo">
 +          </div>
 +
 +          <ul class="center f6 list ma0 mv3 pa0 tc">
 +            {{- with .Site.Params.github_repo -}}<li class="dib mr3"><a href="{{ . }}" class="dim link light-gray pv2">File an Issue</a></li>{{- end -}}
 +            {{- with .Site.Params.forum -}}<li class="dib mr3"><a href="{{ . }}" class="dim link light-gray pv2">Get Help</a></li>{{- end -}}
 +            {{- with .Site.Params.gitter -}}<li class="dib"><a href="{{ . }}" class="dim link light-gray pv2">Discuss Source Code</a></li>{{- end -}}
 +          </ul>
 +
 +          <ul class="center f6 list ma0 mv4 pa0 tc">
 +            <li class="dib mr3"><a href="https://twitter.com/gohugoio" class="dim link light-gray pv2">@GoHugoIO</a></li>
 +            <li class="dib mr3"><a href="https://twitter.com/spf13" class="dim link light-gray pv2">@spf13</a></li>
 +            <li class="dib"><a href="https://twitter.com/bepsays" class="dim link light-gray pv2">@bepsays</a></li>
 +          </ul>
 +
 +          {{ with  getenv "REPOSITORY_URL" -}}
 +          <p class="center f6 tc w-70"><a href="https://www.netlify.com"><img src="/images/netlify-dark.svg" alt="Netlify badge"></a></p>
 +          {{- end }}
 +
 +      </div>
 +
 +      <div class="w-100 w-50-l"> 
 +        {{ partial "home-page-sections/sponsors.html" (dict "cx" .  "gtag" "footer" "classes_section" "pb3 w-100" "classes_copy" "f7 w-90-ns") }}
 +      </div>
 +
 +    </div>
 +
 +    <div class="f7 gray mb5 mb0-ns ph3 w-100"> 
 +      <p class="dib mr4">The Hugo logos are copyright © Steve Francia 2013–{{ now.Year }}.</p>
 +      <p class="dib">The Hugo Gopher is based on an original work by Renée French.</p>
 +    </div>
 +
 +    <img src="/images/gopher-side_color.svg" alt="" class="absolute-l bottom-0 dn db-l h4 right-0 z-999"/>
 +
++    <div class="bg-primary-color-dark bottom-0 left-0 right-0 dn-l fixed pb3 ph3 pt3 w-100">
 +      {{- partial "nav-mobile.html" . -}}
 +    </div>
 +
 +</footer>
index b6c521dc964e17909af438efdecaa97197898438,0000000000000000000000000000000000000000..8c97ac4545fe55220a0cc5ffeb652eafa0d5beed
mode 100644,000000..100644
--- /dev/null
@@@ -1,6 -1,0 +1,6 @@@
- </form>
 +<form id="site-search-form" action="" role="search">
 +  <fieldset class="bn ma0 pa0">
 +    <label class="clip" for="search-input">Search</label>
 +    <input type="search" id="search-input" class="needs-js bg-left bn f5 input-reset lh-solid mt3 mt0-ns pl4 pv2 w5 white" placeholder="Search the Docs" name="search-input" value="" style="background: url('/images/icon-search.png') 5px 11px/16px 16px no-repeat; background-color: rgba(255,255,255,0);">
 +  </fieldset>
++</form>
index daffbc0f00b3584b6eb9ed122515f692848e7ac1,0000000000000000000000000000000000000000..9222aad764487a0caa0727b8124241117af09fcb
mode 100644,000000..100644
--- /dev/null
@@@ -1,43 -1,0 +1,43 @@@
-     "postcss": "^7.0.32",
 +{
 +  "name": "gohugo-default-styles",
 +  "version": "1.1.0",
 +  "description": "Default Theme for Hugo Sites",
 +  "main": "index.js",
 +  "homepage": "https://gohugo.io/",
 +  "bugs": {
 +    "url": "https://github.com/gohugoio/gohugoioTheme/issues"
 +  },
 +  "repository": {
 +    "type": "git",
 +    "url": "git+https://github.com/gohugoio/gohugoioTheme.git"
 +  },
 +  "author": "budparr",
 +  "license": "MIT",
 +  "scripts": {
 +    "build": "NODE_ENV=production webpack",
 +    "build-dev": "NODE_ENV=development webpack --progress --watch",
 +    "start": "npm run build-dev"
 +  },
 +  "devDependencies": {
 +    "clean-webpack-plugin": "^1.0.0",
 +    "clipboard": "^2.0.4",
 +    "css-loader": "^4.3.0",
 +    "docsearch.js": "^2.6.1",
 +    "file-loader": "^2.0.0",
 +    "glob-all": "^3.1.0",
 +    "highlight.js": "^9.13.1",
 +    "lazysizes": "^5.2.1",
 +    "mini-css-extract-plugin": "^0.4.4",
++    "postcss": "^7.0.36",
 +    "postcss-cssnext": "^3.1.0",
 +    "postcss-import": "^12.0.1",
 +    "postcss-loader": "^3.0.0",
 +    "purgecss-webpack-plugin": "^1.3.1",
 +    "scrolldir": "^1.4.0",
 +    "tachyons": "^4.7.0",
 +    "typeface-muli": "0.0.54",
 +    "webpack": "^4.44.1",
 +    "webpack-command": "^0.4.2"
 +  },
 +  "dependencies": {}
 +}
index ecff0980d1e516148a9cf2a88d72c99374c9706e,0000000000000000000000000000000000000000..a0b2c4e28d9c2c5fb682eaee80b6eec513c40aac
mode 100644,000000..100644
--- /dev/null
@@@ -1,1 -1,0 +1,1 @@@
- # github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7
++# github.com/gohugoio/gohugoioTheme v0.0.0-20211211134334-0fe25799bb58
index 81b712c0a3e8e64c0959ece07cf88ff58a941cd5,0000000000000000000000000000000000000000..4d3bb1f60bd15249dec62f03a3d2360b73edea5b
mode 100644,000000..100644
--- /dev/null
@@@ -1,91 -1,0 +1,91 @@@
- dir = ":resourceDir/_gen"
- maxAge = -1
 +baseURL = "https://gohugo.io/"
 +paginate = 100
 +defaultContentLanguage = "en"
 +enableEmoji = true
 +# Set the unicode character used for the "return" link in page footnotes.
 +footnotereturnlinkcontents = "↩"
 +languageCode = "en-us"
 +title = "Hugo"
 +
 +googleAnalytics = "UA-7131036-4"
 +
 +pluralizeListTitles = false
 +
 +# We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below).
 +disableAliases = true
 +
 +[outputs]
 +home = [ "HTML", "RSS", "REDIR", "HEADERS" ]
 +section = [ "HTML", "RSS"]
 +
 +[mediaTypes]
 +[mediaTypes."text/netlify"]
 +delimiter = ""
 +
 +[outputFormats]
 +[outputFormats.REDIR]
 +mediatype = "text/netlify"
 +baseName = "_redirects"
 +isPlainText = true
 +notAlternative = true
 +[outputFormats.HEADERS]
 +mediatype = "text/netlify"
 +baseName = "_headers"
 +isPlainText = true
 +notAlternative = true
 +
 +[caches]
 +[caches.getjson]
 +dir = ":cacheDir/:project"
 +maxAge = -1
 +[caches.getcsv]
 +dir = ":cacheDir/:project"
 +maxAge = -1
 +[caches.images]
++dir = ":cacheDir/images"
++maxAge = "1440h"
 +[caches.assets]
 +dir = ":resourceDir/_gen"
 +maxAge = -1
 +
 +
 +[related]
 +
 +threshold = 80
 +includeNewer = true
 +toLower = false
 +
 +[[related.indices]]
 +name = "keywords"
 +weight = 100
 +[[related.indices]]
 +name = "date"
 +weight = 10
 +pattern = "2006"
 +
 +[social]
 +twitter = "GoHugoIO"
 +
 +
 +# MARKDOWN
 +## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday
 +[blackfriday]
 +plainIDAnchors = true
 +# See https://github.com/gohugoio/hugo/issues/2424
 +hrefTargetBlank = false
 +angledQuotes = false
 +latexDashes = true
 +
 +[imaging]
 +# See https://github.com/disintegration/imaging
 +# CatmullRom is a sharp bicubic filter which should fit the docs site well with its many screenshots.
 +# Note that you can also set this per image processing.
 +resampleFilter = "CatmullRom"
 +
 +# Default JPEG quality setting. Default is 75.
 +quality = 75
 +
 +anchor = "smart"
 +
 +[taxonomies]
 +category = "categories"
index c24c0ccc4ae7c9d2655b9412dc89707e32d36d2c,0000000000000000000000000000000000000000..620ec0b930963cd2bb5df5527855971d0a91e56c
mode 100644,000000..100644
--- /dev/null
@@@ -1,582 -1,0 +1,582 @@@
- linktitle: Multilingual and i18n
 +---
 +title: Multilingual Mode
++linktitle: Multilingual
 +description: Hugo supports the creation of websites with multiple languages side by side.
 +date: 2017-01-10
 +publishdate: 2017-01-10
 +lastmod: 2017-01-10
 +categories: [content management]
 +keywords: [multilingual,i18n, internationalization]
 +menu:
 +  docs:
 +    parent: "content-management"
 +    weight: 150
 +weight: 150   #rem
 +draft: false
 +aliases: [/content/multilingual/,/tutorials/create-a-multilingual-site/]
 +toc: true
 +---
 +
 +You should define the available languages in a `languages` section in your site configuration.
 +
 +> Also See [Hugo Multilingual Part 1: Content translation]
 +
 +## Configure Languages
 +
 +The following is an example of a site configuration for a multilingual Hugo project:
 +
 +{{< code-toggle file="config" >}}
 +defaultContentLanguage = "en"
 +copyright = "Everything is mine"
 +
 +[params]
 +[params.navigation]
 +help  = "Help"
 +
 +[languages]
 +[languages.en]
 +title = "My blog"
 +weight = 1
 +[languages.en.params]
 +linkedin = "https://linkedin.com/whoever"
 +
 +[languages.fr]
 +title = "Mon blogue"
 +weight = 2
 +[languages.fr.params]
 +linkedin = "https://linkedin.com/fr/whoever"
 +[languages.fr.params.navigation]
 +help  = "Aide"
 +
 +[languages.ar]
 +title = "مدونتي"
 +weight = 2
 +languagedirection = "rtl"
 +
 +[languages.pt-pt]
 +title = "O meu blog"
 +weight = 3
 +{{< /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). This also works for `params`, as demonstrated with `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.
 +
 +When working with front matter `Params` in [single page templates], omit the `params` in the key for the translation.
 +
 +`defaultContentLanguage` sets the project's default language. If not set, the default language will be `en`.
 +
 +If the default language needs to be rendered below its own language code (`/en`) like the others, set `defaultContentLanguageInSubdir: true`.
 +
 +Only the obvious non-global options can be overridden per language. Examples of global options are `baseURL`, `buildDrafts`, etc.
 +
 +**Please note:** use lowercase language codes, even when using regional languages (ie. use pt-pt instead of pt-PT). Currently Hugo language internals lowercase language codes, which can cause conflicts with settings like `defaultContentLanguage` which are not lowercased. Please track the evolution of this issue in [Hugo repository issue tracker](https://github.com/gohugoio/hugo/issues/7344)
 +
 +### Disable a Language
 +
 +You can disable one or more languages. This can be useful when working on a new translation.
 +
 +{{< code-toggle file="config" >}}
 +disableLanguages = ["fr", "ja"]
 +{{< /code-toggle >}}
 +
 +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]:
 +
 +```bash
 +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:
 +
 +```bash
 +HUGO_DISABLELANGUAGES=" " hugo server
 +```
 +
 +### Configure Multilingual Multihost
 +
 +From **Hugo 0.31** we support multiple languages in a multihost configuration. See [this issue](https://github.com/gohugoio/hugo/issues/4027) for details.
 +
 +This means that you can now configure a `baseURL` per `language`:
 +
 +> If a `baseURL` is set on the `language` level, then all languages must have one and they must all be different.
 +
 +Example:
 +
 +{{< code-toggle file="config" >}}
 +[languages]
 +[languages.fr]
 +baseURL = "https://example.fr"
 +languageName = "Français"
 +weight = 1
 +title = "En Français"
 +
 +[languages.en]
 +baseURL = "https://example.com"
 +languageName = "English"
 +weight = 2
 +title = "In English"
 +{{</ code-toggle >}}
 +
 +With the above, the two sites will be generated into `public` with their own root:
 +
 +```text
 +public
 +├── en
 +└── fr
 +```
 +
 +**All URLs (i.e `.Permalink` etc.) will be generated from that root. So the English home page above will have its `.Permalink` set to `https://example.com/`.**
 +
 +When you run `hugo server` we will start multiple HTTP servers. You will typically see something like this in the console:
 +
 +```text
 +Web Server is available at 127.0.0.1:1313 (bind address 127.0.0.1)
 +Web Server is available at 127.0.0.1:1314 (bind address 127.0.0.1)
 +Press Ctrl+C to stop
 +```
 +
 +Live reload and `--navigateToChanged` between the servers work as expected.
 +
 +### Taxonomies and Blackfriday
 +
 +Taxonomies and [Blackfriday configuration][config] can also be set per language:
 +
 +{{< code-toggle file="config" >}}
 +[Taxonomies]
 +tag = "tags"
 +
 +[blackfriday]
 +angledQuotes = true
 +hrefTargetBlank = true
 +
 +[languages]
 +[languages.en]
 +weight = 1
 +title = "English"
 +[languages.en.blackfriday]
 +angledQuotes = false
 +
 +[languages.fr]
 +weight = 2
 +title = "Français"
 +[languages.fr.Taxonomies]
 +plaque = "plaques"
 +{{</ code-toggle >}}
 +
 +## Translate Your Content
 +
 +There are two ways to manage your content translations. Both ensure each page is assigned a language and is linked to its counterpart translations.
 +
 +### Translation by filename
 +
 +Considering the following example:
 +
 +1. `/content/about.en.md`
 +2. `/content/about.fr.md`
 +
 +The first file is assigned the English language and is linked to the second.
 +The second file is assigned the French language and is linked to the first.
 +
 +Their language is __assigned__ according to the language code added as a __suffix to the filename__.
 +
 +By having the same **path and base filename**, the content pieces are __linked__ together as translated pages.
 +
 +{{< note >}}
 +If a file has no language code, it will be assigned the default language.
 +{{</ note >}}
 +
 +### Translation by content directory
 +
 +This system uses different content directories for each of the languages. Each language's content directory is set using the `contentDir` param.
 +
 +{{< code-toggle file="config" >}}
 +languages:
 +  en:
 +    weight: 10
 +    languageName: "English"
 +    contentDir: "content/english"
 +  fr:
 +    weight: 20
 +    languageName: "Français"
 +    contentDir: "content/french"
 +{{< /code-toggle >}}
 +
 +The value of `contentDir` can be any valid path -- even absolute path references. The only restriction is that the content directories cannot overlap.
 +
 +Considering the following example in conjunction with the configuration above:
 +
 +1. `/content/english/about.md`
 +2. `/content/french/about.md`
 +
 +The first file is assigned the English language and is linked to the second.
 +The second file is assigned the French language and is linked to the first.
 +
 +Their language is __assigned__ according to the content directory they are __placed__ in.
 +
 +By having the same **path and basename** (relative to their language content directory), the content pieces are __linked__ together as translated pages.
 +
 +### Bypassing default linking
 +
 +Any pages sharing the same `translationKey` set in front matter will be linked as translated pages regardless of basename or location.
 +
 +Considering the following example:
 +
 +1. `/content/about-us.en.md`
 +2. `/content/om.nn.md`
 +3. `/content/presentation/a-propos.fr.md`
 +
 +{{< code-toggle >}}
 +translationKey: "about"
 +{{< /code-toggle >}}
 +
 +By setting the `translationKey` front matter param to `about` in all three pages, they will be __linked__ as translated pages.
 +
 +### Localizing permalinks
 +
 +Because paths and filenames are used to handle linking, all translated pages will share the same URL (apart from the language subdirectory).
 +
 +To localize the URLs, the [`slug`]({{< ref "/content-management/organization/index.md#slug" >}}) or [`url`]({{< ref "/content-management/organization/index.md#url" >}}) front matter param can be set in any of the non-default language file.
 +
 +For example, a French translation (`content/about.fr.md`) can have its own localized slug.
 +
 +{{< code-toggle >}}
 +Title: A Propos
 +slug: "a-propos"
 +{{< /code-toggle >}}
 +
 +At render, Hugo will build both `/about/` and `/fr/a-propos/` while maintaining their translation linking.
 +
 +{{% note %}}
 +If using `url`, remember to include the language part as well: `/fr/compagnie/a-propos/`.
 +{{%/ note %}}
 +
 +### Page Bundles
 +
 +To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (markdown files, html files etc...).
 +
 +Therefore, from within a template, the page will have access to the files from all linked pages' bundles.
 +
 +If, across the linked bundles, two or more files share the same basename, only one will be included and chosen as follows:
 +
 +* File from current language bundle, if present.
 +* First file found across bundles by order of language `Weight`.
 +
 +{{% note %}}
 +Page Bundle resources follow the same language assignment logic as content files, both by filename (`image.jpg`, `image.fr.jpg`) and by directory (`english/about/header.jpg`, `french/about/header.jpg`).
 +{{%/ note %}}
 +
 +## Reference the Translated Content
 +
 +To create a list of links to translated content, use a template similar to the following:
 +
 +{{< code file="layouts/partials/i18nlist.html" >}}
 +{{ if .IsTranslated }}
 +<h4>{{ i18n "translations" }}</h4>
 +<ul>
 +  {{ range .Translations }}
 +  <li>
 +    <a href="{{ .Permalink }}">{{ .Lang }}: {{ .Title }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
 +  </li>
 +  {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, whether a [single content page][contenttemplate] or the [homepage]. It will not print anything if there are no translations for a given page.
 +
 +The above also uses the [`i18n` function][i18func] described in the next section.
 +
 +### List All Available Languages
 +
 +`.AllTranslations` on a `Page` can be used to list all translations, including the page itself. On the home page it can be used to build a language navigator:
 +
 +{{< code file="layouts/partials/allLanguages.html" >}}
 +<ul>
 +{{ range $.Site.Home.AllTranslations }}
 +<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
 +{{ end }}
 +</ul>
 +{{< /code >}}
 +
 +## Translation of Strings
 +
 +Hugo uses [go-i18n] to support string translations. [See the project's source repository][go-i18n-source] to find tools that will help you manage your translation workflows.
 +
 +Translations are collected from the `themes/<THEME>/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to [RFC 5646] with names such as `en-US.toml`, `fr.toml`, etc.
 +
 +Artificial languages with private use subtags as defined in [RFC 5646 &#167; 2.2.7](https://datatracker.ietf.org/doc/html/rfc5646#section-2.2.7) are also supported. You may omit the `art-x-` prefix for brevity. For example:
 +
 +```text
 +art-x-hugolang
 +hugolang
 +```
 +
 +Private use subtags must not exceed 8 alphanumeric characters.
 +
 +### Query basic translation
 +
 +From within your templates, use the `i18n` function like this:
 +
 +```go-html-template
 +{{ i18n "home" }}
 +```
 +
 +The function will search for the `"home"` id:
 +
 +{{< code-toggle file="i18n/en-US" >}}
 +[home]
 +other = "Home"
 +{{< /code-toggle >}}
 +
 +The result will be
 +
 +```text
 +Home
 +```
 +
 +### Query a flexible translation with variables
 +
 +Often you will want to use the page variables in the translation strings. To do so, pass the `.` context when calling `i18n`:
 +
 +```go-html-template
 +{{ i18n "wordCount" . }}
 +```
 +
 +The function will pass the `.` context to the `"wordCount"` id:
 +
 +{{< code-toggle file="i18n/en-US" >}}
 +[wordCount]
 +other = "This article has {{ .WordCount }} words."
 +{{< /code-toggle >}}
 +
 +Assume `.WordCount` in the context has value is 101. The result will be:
 +
 +```text
 +This article has 101 words.
 +```
 +
 +### Query a singular/plural translation
 +
 +In order to meet singular/plural requirement, you must pass a dictionary (map) with a numeric `.Count` property to the `i18n` function. The below example uses `.ReadingTime` variable which has a built-in `.Count` property.
 +
 +```go-html-template
 +{{ i18n "readingTime" .ReadingTime }}
 +```
 +
 +The function will read `.Count` from `.ReadingTime` and evaluate where the number is singular (`one`) or plural (`other`). After that, it will pass to `readingTime` id:
 +
 +{{< code-toggle file="i18n/en-US" >}}
 +[readingTime]
 +one = "One minute to read"
 +other = "{{.Count}} minutes to read"
 +{{< /code-toggle >}}
 +
 +Assume `.ReadingTime.Count` in the context has value of 525600. The result will be:
 +
 +```text
 +525600 minutes to read
 +```
 +
 +If `.ReadingTime.Count` in the context has value is 1. The result is:
 +
 +```text
 +One minute to read
 +```
 +
 +In case you need to pass custom data: (`(dict "Count" 25)` is minimum requirement)
 +
 +```go-html-template
 +{{ i18n "readingTime" (dict "Count" 25 "FirstArgument" true "SecondArgument" false "Etc" "so on, so far") }}
 +```
 +
 +## Localization
 +
 +The following localization examples assume your site's primary language is English, with translations to French and German.
 +
 +{{< code-toggle file="config" >}}
 +defaultContentLang = 'en'
 +
 +[languages]
 +[languages.en]
 +contentDir = 'content/en'
 +languageName = 'English'
 +weight = 1
 +[languages.fr]
 +contentDir = 'content/fr'
 +languageName = 'Français'
 +weight = 2
 +[languages.de]
 +contentDir = 'content/de'
 +languageName = 'Deutsch'
 +weight = 3
 +
 +{{< /code-toggle >}}
 +
 +### Dates
 +
 +With this front matter:
 +
 +{{< code-toggle >}}
 +date = 2021-11-03T12:34:56+01:00
 +{{< /code-toggle >}}
 +
 +And this template code:
 +
 +```go-html-template
 +{{ .Date | time.Format ":date_full" }}
 +```
 +
 +The rendered page displays:
 +
 +Language|Value
 +:--|:--
 +English|Wednesday, November 3, 2021
 +Français|mercredi 3 novembre 2021
 +Deutsch|Mittwoch, 3. November 2021
 +
 +See [time.Format] for details.
 +
 +### Currency
 +
 +With this template code:
 +
 +```go-html-template
 +{{ 512.5032 | lang.FormatCurrency 2 "USD" }}
 +```
 +
 +The rendered page displays:
 +
 +Language|Value
 +:--|:--
 +English|$512.50
 +Français|512,50 $US
 +Deutsch|512,50 $
 +
 +See [lang.FormatCurrency] and [lang.FormatAccounting] for details.
 +
 +### Numbers
 +
 +With this template code:
 +
 +```go-html-template
 +{{ 512.5032 | lang.FormatNumber 2 }}
 +```
 +
 +The rendered page displays:
 +
 +Language|Value
 +:--|:--
 +English|512.50
 +Français|512,50
 +Deutsch|512,50
 +
 +See [lang.FormatNumber] and [lang.FormatNumberCustom] for details.
 +
 +### Percentages
 +
 +With this template code:
 +
 +```go-html-template
 +{{ 512.5032 | lang.FormatPercent 2 }} ---> 512.50%
 +```
 +
 +The rendered page displays:
 +
 +Language|Value
 +:--|:--
 +English|512.50%
 +Français|512,50 %
 +Deutsch|512,50 %
 +
 +See [lang.FormatPercent] for details.
 +
 +## Menus
 +
 +You can define your menus for each language independently. Creating multilingual menus works just like [creating regular menus][menus], except they're defined in language-specific blocks in the configuration file:
 +
 +{{< code-toggle file="config" >}}
 +defaultContentLanguage = "en"
 +
 +[languages.en]
 +weight = 0
 +languageName = "English"
 +
 +[[languages.en.menu.main]]
 +url    = "/"
 +name   = "Home"
 +weight = 0
 +
 +[languages.de]
 +weight = 10
 +languageName = "Deutsch"
 +
 +[[languages.de.menu.main]]
 +url    = "/"
 +name   = "Startseite"
 +weight = 0
 +{{< /code-toggle >}}
 +
 +The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu in the current language. Note that `absLangURL` below will link to the correct locale of your website. Without it, menu entries in all languages would link to the English version, since it's the default content language that resides in the root directory.
 +
 +```go-html-template
 +<ul>
 +    {{- $currentPage := . -}}
 +    {{ range .Site.Menus.main -}}
 +    <li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
 +        <a href="{{ .URL | absLangURL }}">{{ .Name }}</a>
 +    </li>
 +    {{- end }}
 +</ul>
 +```
 +
 +## Missing Translations
 +
 +If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown.
 +
 +While translating a Hugo website, it can be handy to have a visual indicator of missing translations. The [`enableMissingTranslationPlaceholders` configuration option][config] will flag all untranslated strings with the placeholder `[i18n] identifier`, where `identifier` is the id of the missing translation.
 +
 +{{% note %}}
 +Hugo will generate your website with these missing translation placeholders. It might not be suitable for production environments.
 +{{% /note %}}
 +
 +For merging of content from other languages (i.e. missing content translations), see [lang.Merge].
 +
 +To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
 +
 +```bash
 +hugo --i18n-warnings | grep i18n
 +i18n|MISSING_TRANSLATION|en|wordCount
 +```
 +
 +## Multilingual Themes support
 +
 +To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there is more than one language, URLs must meet the following criteria:
 +
 +* Come from the built-in `.Permalink` or `.RelPermalink`
 +* Be constructed with the [`relLangURL` template function][rellangurl] or the [`absLangURL` template function][abslangurl] **OR** be prefixed with `{{ .LanguagePrefix }}`
 +
 +If there is more than one language defined, the `LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string (and is therefore harmless for single-language Hugo websites).
 +
 +[abslangurl]: /functions/abslangurl
 +[config]: /getting-started/configuration/
 +[contenttemplate]: /templates/single-page-templates/
 +[go-i18n-source]: https://github.com/nicksnyder/go-i18n
 +[go-i18n]: https://github.com/nicksnyder/go-i18n
 +[homepage]: /templates/homepage/
 +[Hugo Multilingual Part 1: Content translation]: https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/
 +[i18func]: /functions/i18n/
 +[lang.FormatAccounting]: /functions/lang/#langformataccounting
 +[lang.FormatCurrency]: /functions/lang/#langformatcurrency
 +[lang.FormatNumber]: /functions/lang/#langformatnumber
 +[lang.FormatNumberCustom]: functions/lang/#langformatnumbercustom
 +[lang.FormatPercent]: /functions/lang/#langformatpercent
 +[lang.Merge]: /functions/lang.merge/
 +[menus]: /content-management/menus/
 +[OS environment]: /getting-started/configuration/#configure-with-environment-variables
 +[rellangurl]: /functions/rellangurl
 +[RFC 5646]: https://tools.ietf.org/html/rfc5646
 +[single page templates]: /templates/single-page-templates/
 +[time.Format]: /functions/dateformat
index 6ba6ccd08153005e879a4e1bc5d43cd92bade14d,0000000000000000000000000000000000000000..27df5c6f77b7f0eb7846f6de13af622d6c5bcc73
mode 100644,000000..100644
--- /dev/null
@@@ -1,442 -1,0 +1,436 @@@
- We use the [Travis CI loop](https://travis-ci.org/gohugoio/hugo) (Linux and OS&nbsp;X) and [AppVeyor](https://ci.appveyor.com/project/gohugoio/hugo/branch/master) (Windows) to compile Hugo with your additions. This should ensure that everything works as expected before merging your pull request. This in most cases only relevant if you made changes to the codebase of Hugo.
- ![Automatic builds and their status](/images/contribute/development/ci-errors.png)
- Above you can see that Travis wasn't able to compile the changes in this pull request. Click on "Details" and try to investigate why the build failed. But it doesn't have to be your fault. Mostly, the `master` branch that we used as foundation for your pull request should build without problems.
- If you have questions, leave a comment in the pull request. We are willing to assist you.
 +---
 +title: Contribute to Hugo Development
 +linktitle: Development
 +description: Hugo relies heavily on contributions from the open source community.
 +date: 2017-02-01
 +publishdate: 2017-02-01
 +lastmod: 2017-02-01
 +categories: [contribute]
 +keywords: [dev,open source]
 +authors: [digitalcraftsman]
 +menu:
 +  docs:
 +    parent: "contribute"
 +    weight: 10
 +weight: 10
 +sections_weight: 10
 +draft: false
 +toc: true
 +---
 +
 +## Introduction
 +
 +Hugo is an open-source project and lives by the work of its [contributors][]. There are plenty of [open issues][issues], and we need your help to make Hugo even more awesome. You don't need to be a Go guru to contribute to the project's development.
 +
 +## Assumptions
 +
 +This contribution guide takes a step-by-step approach in hopes of helping newcomers. Therefore, we only assume the following:
 +
 +* You are new to Git or open-source projects in general
 +* You are a fan of Hugo and enthusiastic about contributing to the project
 +
 +{{% note "Additional Questions?" %}}
 +If you're struggling at any point in this contribution guide, reach out to the Hugo community in [Hugo's Discussion forum](https://discourse.gohugo.io).
 +{{% /note %}}
 +
 +## Install Go
 +
 +The installation of Go should take only a few minutes. You have more than one option to get Go up and running on your machine.
 +
 +If you are having trouble following the installation guides for Go, check out [Go Bootcamp, which contains setups for every platform][gobootcamp] or reach out to the Hugo community in the [Hugo Discussion Forums][forums].
 +
 +### Install Go From Source
 +
 +[Download the latest stable version of Go][godl] and follow the official [Go installation guide][goinstall].
 +
 +Once you're finished installing Go, let's confirm everything is working correctly. Open a terminal---or command line under Windows--and type the following:
 +
 +```
 +go version
 +```
 +
 +You should see something similar to the following written to the console. Note that the version here reflects the most recent version of Go as of the last update for this page:
 +
 +```
 +go version go1.12 darwin/amd64
 +```
 +
 +Next, make sure that you set up your `GOPATH` [as described in the installation guide][setupgopath].
 +
 +You can print the `GOPATH` with `echo $GOPATH`. You should see a non-empty string containing a valid path to your Go workspace; for example:
 +
 +```
 +/Users/<yourusername>/Code/go
 +```
 +
 +### Install Go with Homebrew
 +
 +If you are a MacOS user and have [Homebrew](https://brew.sh/) installed on your machine, installing Go is as simple as the following command:
 +
 +{{< code file="install-go.sh" >}}
 +brew install go
 +{{< /code >}}
 +
 +### Install Go via GVM
 +
 +More experienced users can use the [Go Version Manager][gvm] (GVM). GVM allows you to switch between different Go versions *on the same machine*. If you're a beginner, you probably don't need this feature. However, GVM makes it easy to upgrade to a new released Go version with just a few commands.
 +
 +GVM comes in especially handy if you follow the development of Hugo over a longer period of time. Future versions of Hugo will usually be compiled with the latest version of Go. Sooner or later, you will have to upgrade if you want to keep up.
 +
 +## Create a GitHub Account
 +
 +If you're going to contribute code, you'll need to have an account on GitHub. Go to [www.github.com/join](https://github.com/join) and set up a personal account.
 +
 +## 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 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.
 +
 +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 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.
 +
 +### Git Graphical Front Ends
 +
 +There are several [GUI clients](https://git-scm.com/downloads/guis) that help you to operate Git. Not all are available for all operating systems and maybe differ in their usage. Because of this we will document how to use the command line, since the commands are the same everywhere.
 +
 +### Install Hub on Your System (Optional)
 +
 +Hub is a great tool for working with GitHub. The main site for it is [hub.github.com](https://hub.github.com/). Feel free to install this little Git wrapper.
 +
 +On a Mac, you can install [Hub](https://github.com/github/hub) using [Homebrew](https://brew.sh):
 +
 +```
 +brew install hub
 +```
 +
 +Now we'll create an [alias in Bash](https://tldp.org/LDP/abs/html/aliases.html) so that typing `git` actually runs `Hub`:
 +
 +```
 +echo "alias git='hub'" >> ~/.bash_profile
 +```
 +
 +Confirm the installation:
 +
 +```
 +git version 2.21.0
 +hub version 2.10.0
 +```
 +
 +## Set up your working copy
 +
 +You set up the working copy of the repository locally on your computer. Your local copy of the files is what you'll edit, compile, and end up pushing back to GitHub. The main steps are cloning the repository and creating your fork as a remote.
 +
 +### Clone the repository
 +
 +We assume that you've set up your `GOPATH` (see the section above if you're unsure about this). You should now copy the Hugo repository down to your computer. You'll hear this called "clone the repo". GitHub's [help pages](https://help.github.com/articles/cloning-a-repository/) give us a short explanation:
 +
 +> When you create a repository on GitHub, it exists as a remote repository. You can create a local clone of your repository on your computer and sync between the two locations.
 +
 +We're going to clone the [master Hugo repository](https://github.com/gohugoio/hugo). That seems counter-intuitive, since you won't have commit rights on it. But it's required for the Go workflow. You'll work on a copy of the master and push your changes to your own repository on GitHub.
 +
 +So, let's make a new directory and clone that master repository:
 +
 +```
 +mkdir $HOME/src
 +cd $HOME/src
 +git clone https://github.com/gohugoio/hugo.git
 +```
 +
 +> Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build. 
 +> The easiest is to clone Hugo in a directory outside of GOPATH
 +
 +And then, install dependencies of Hugo by running the following in the cloned directory:
 +
 +```
 +cd $HOME/src/hugo
 +go install
 +```
 +
 +
 +Hugo relies on [mage](https://github.com/magefile/mage) for some convenient build and test targets. If you don't already have it, get it:
 +
 +```
 +go install github.com/magefile/mage@latest
 +```
 +
 +### Fork the repository
 +
 +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.
 +
 +#### Fork by hand
 +
 +Open the [Hugo repository](https://github.com/gohugoio/hugo) on GitHub and click on the "Fork" button in the top right.
 +
 +![Fork button](/images/contribute/development/forking-a-repository.png)
 +
 +Now open your fork repository on GitHub and copy the remote url of your fork. You can choose between HTTPS and SSH as protocol that Git should use for the following operations. HTTPS works always [if you're not sure](https://help.github.com/articles/which-remote-url-should-i-use/).
 +
 +![Copy remote url](/images/contribute/development/copy-remote-url.png)
 +
 +Switch back to the terminal and move into the directory of the cloned master repository from the last step.
 +
 +```
 +cd $HOME/src/hugo
 +```
 +
 +Now Git needs to know that our fork exists by adding the copied remote url:
 +
 +```
 +git remote add <YOUR-GITHUB-USERNAME> <COPIED REMOTE-URL>
 +```
 +
 +#### Fork with Hub
 +
 +Alternatively, you can use the Git wrapper Hub. Hub makes forking a repository easy:
 +
 +```
 +git fork
 +```
 +
 +That command will log in to GitHub using your account, create a fork of the repository that you're currently working in, and add it as a remote to your working copy.
 +
 +#### Trust, but verify
 +
 +Let's check if everything went right by listing all known remotes:
 +
 +```
 +git remote -v
 +```
 +
 +The output should look similar:
 +
 +```
 +digitalcraftsman    git@github.com:digitalcraftsman/hugo.git (fetch)
 +digitalcraftsman    git@github.com:digitalcraftsman/hugo.git (push)
 +origin  https://github.com/gohugoio/hugo (fetch)
 +origin  https://github.com/gohugoio/hugo (push)
 +```
 +
 +## The Hugo Git Contribution Workflow
 +
 +### Create a new branch
 +
 +You should never develop against the "master" branch. The development team will not accept a pull request against that branch. Instead, create a descriptive named branch and work on it.
 +
 +First, you should always pull the latest changes from the master repository:
 +
 +```
 +git checkout master
 +git pull
 +```
 +
 +Now we can create a new branch for your additions:
 +
 +```
 +git checkout -b <BRANCH-NAME>
 +```
 +
 +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
 +
 +Perhaps you want to start contributing to the Hugo docs. If so, you can ignore most of the following steps and focus on the `/docs` directory within your newly cloned repository. You can change directories into the Hugo docs using `cd docs`.
 +
 +You can start Hugo's built-in server via `hugo server`. Browse the documentation by entering [http://localhost:1313](http://localhost:1313) in the address bar of your browser. The server automatically updates the page whenever you change content.
 +
 +We have developed a [separate Hugo documentation contribution guide][docscontrib] for more information on how the Hugo docs are built, organized, and improved by the generosity of people like you.
 +
 +### Build Hugo
 +
 +While making changes in the codebase it's a good idea to build the binary to test them:
 +
 +```
 +mage hugo
 +```
 +
 +This command generates the binary file at the root of the repository.
 +
 +If you want to install the binary in `$GOPATH/bin`, run
 +
 +```
 +mage install
 +```
 +
 +### Test 
 +Sometimes changes on the codebase can cause unintended side effects. Or they don't work as expected. Most functions have their own test cases. You can find them in files ending with `_test.go`.
 +
 +Make sure the commands 
 +
 +```
 +mage -v check
 +```
 +
 +passes.
 +
 +### 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 additions:
 +
 +```
 +mage fmt
 +```
 +
 +Once you made your additions commit your changes. Make sure that you follow our [code contribution guidelines](https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md):
 +
 +```
 +# Add all changed files
 +git add --all
 +git commit --message "YOUR COMMIT MESSAGE"
 +```
 +
 +The commit message should describe what the commit does (e.g. add feature XYZ), not how it is done.
 +
 +### Modify commits
 +
 +You noticed some commit messages don't fulfill the code contribution guidelines or you just forget something to add some files? No problem. Git provides the necessary tools to fix such problems. The next two methods cover all common cases.
 +
 +If you are unsure what a command does leave the commit as it is. We can fix your commits later in the pull request.
 +
 +#### Modify the last commit
 +
 +Let's say you want to modify the last commit message. Run the following command and replace the current message:
 +
 +```
 +git commit --amend -m"YOUR NEW COMMIT MESSAGE"
 +```
 +
 +Take a look at the commit log to see the change:
 +
 +```
 +git log
 +# Exit with q
 +```
 +
 +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
 +git commit --amend
 +```
 +
 +#### Modify multiple commits
 +
 +{{% warning "Be Careful Modifying Multiple Commits"%}}
 +Modifications such as those described in this section can have serious unintended consequences. Skip this section if you're not sure!
 +{{% /warning %}}
 +
 +This is a bit more advanced. Git allows you to [rebase](https://git-scm.com/docs/git-rebase) commits interactively. In other words: it allows you to rewrite the commit history.
 +
 +```
 +git rebase --interactive @~6
 +```
 +
 +The `6` at the end of the command represents the number of commits that should be modified. An editor should open and present a list of last six commit messages:
 +
 +```
 +pick 80d02a1 tpl: Add hasPrefix to the template funcs' "smoke test"
 +pick aaee038 tpl: Sort the smoke tests
 +pick f0dbf2c tpl: Add the other test case for hasPrefix
 +pick 911c35b Add "How to contribute to Hugo" tutorial
 +pick 33c8973 Begin workflow
 +pick 3502f2e Refactoring and typo fixes
 +```
 +
 +In the case above we should merge the last two commits in the commit of this tutorial (`Add "How to contribute to Hugo" tutorial`). You can "squash" commits, i.e. merge two or more commits into a single one.
 +
 +All operations are written before the commit message. Replace "pick" with an operation. In this case `squash` or `s` for short:
 +
 +```
 +pick 80d02a1 tpl: Add hasPrefix to the template funcs' "smoke test"
 +pick aaee038 tpl: Sort the smoke tests
 +pick f0dbf2c tpl: Add the other test case for hasPrefix
 +pick 911c35b Add "How to contribute to Hugo" tutorial
 +squash 33c8973 Begin workflow
 +squash 3502f2e Refactoring and typo fixes
 +```
 +
 +We also want to rewrite the commits message of the third last commit. We forgot "docs:" as prefix according to the code contribution guidelines. The operation to rewrite a commit is called `reword` (or `r` as shortcut).
 +
 +You should end up with a similar setup:
 +
 +```
 +pick 80d02a1 tpl: Add hasPrefix to the template funcs' "smoke test"
 +pick aaee038 tpl: Sort the smoke tests
 +pick f0dbf2c tpl: Add the other test case for hasPrefix
 +reword 911c35b Add "How to contribute to Hugo" tutorial
 +squash 33c8973 Begin workflow
 +squash 3502f2e Refactoring and typo fixes
 +```
 +
 +Close the editor. It should open again with a new tab. A text is instructing you to define a new commit message for the last two commits that should be merged (aka "squashed"). Save the file with <kbd>CTRL</kbd>+<kbd>S</kbd> and close the editor again.
 +
 +A last time a new tab opens. Enter a new commit message and save again. Your terminal should contain a status message. Hopefully this one:
 +
 +```
 +Successfully rebased and updated refs/heads/<BRANCHNAME>.
 +```
 +
 +Check the commit log if everything looks as expected. Should an error occur you can abort this rebase with `git rebase --abort`.
 +
 +### Push commits
 +
 +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>
 +```
 +
 +Now Git knows the destination. Next time when you to push commits you just need to enter `git push`.
 +
 +If you modified your commit history in the last step GitHub will reject your try to push. This is a safety-feature because the commit history isn't the same and new commits can't be appended as usual. You can enforce this push explicitly with `git push --force`.
 +
 +## Open a pull request
 +
 +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 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)
 +
 +The new page summaries the most important information of your pull request. Scroll down and you find the additions of all your commits. Make sure everything looks as expected and click on "Create pull request".
 +
 +### Accept the contributor license agreement
 +
 +Last but not least you should accept the contributor license agreement (CLA). A new comment should be added automatically to your pull request. Click on the yellow badge, accept the agreement and authenticate yourself with your GitHub account. It just takes a few clicks and only needs to be done once.
 +
 +![Accept the CLA](/images/contribute/development/accept-cla.png)
 +
 +### Automatic builds
 +
++We use a GitHub Actions workflow to build and test. This is a matrix build across combinations of operating system (masOS, Windows, and Ubuntu) and Go versions. The workflow is triggered by the submission of a pull request. If you are a first-time contributor, the workflow requires approval from a project maintainer.
 +
 +## Where to start?
 +
 +Thank you for reading through this contribution guide. Hopefully, we will see you again soon on GitHub. There are plenty of [open issues][issues] for you to help with.
 +
 +Feel free to [open an issue][newissue] if you think you found a bug or you have a new idea to improve Hugo. We are happy to hear from you.
 +
 +## Additional References for Learning Git and Go
 +
 +* [Codecademy's Free "Learn Git" Course][codecademy] (Free)
 +* [Code School and GitHub's "Try Git" Tutorial][trygit] (Free)
 +* [The Git Book][gitbook] (Free)
 +* [Go Bootcamp][gobootcamp]
 +* [GitHub Pull Request Tutorial, Thinkful][thinkful]
 +
 +
 +[codecademy]: https://www.codecademy.com/learn/learn-git
 +[contributors]: https://github.com/gohugoio/hugo/graphs/contributors
 +[docscontrib]: /contribute/documentation/
 +[forums]: https://discourse.gohugo.io
 +[gitbook]: https://git-scm.com/
 +[gobootcamp]: http://www.golangbootcamp.com/book/get_setup
 +[godl]: https://golang.org/dl/
 +[goinstall]: https://golang.org/doc/install
 +[gvm]: https://github.com/moovweb/gvm
 +[issues]: https://github.com/gohugoio/hugo/issues
 +[newissue]: https://github.com/gohugoio/hugo/issues/new
 +[releases]: /getting-started/
 +[setupgopath]: https://golang.org/doc/code.html#Workspaces
 +[thinkful]: https://www.thinkful.com/learn/github-pull-request-tutorial/
 +[trygit]: https://try.github.io/levels/1/challenges/1
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..09953aed96230c387c48bee4ba12001896dbe10f
new file mode 100644 (file)
Binary files differ
index 1cf69ee7851768155077ecc753fc3ae231db75f9,0000000000000000000000000000000000000000..350d005eeafebd58058675f3bc3797aec4e3a981
mode 100644,000000..100644
--- /dev/null
@@@ -1,232 -1,0 +1,229 @@@
- title: Image Functions
 +---
- ## Image Filters
++title: Image Filters
 +description: The images namespace provides a list of filters and other image related functions.
 +date: 2017-02-01
 +categories: [functions]
 +aliases: [/functions/imageconfig/]
 +menu:
 +  docs:
 +    parent: "functions"
 +keywords: [images]
 +toc: true
 +---
 +
- ### Overlay
 +See [images.Filter](#filter) for how to apply these filters to an image.
 +
- ### Text
++## Overlay
 +
 +{{< new-in "0.80.0" >}}
 +
 +{{% funcsig %}}
 +images.Overlay SRC X Y
 +{{% /funcsig %}}
 +
 +Overlay creates a filter that overlays the source image at position x y, e.g:
 +
 +
 +```go-html-template
 +{{ $logoFilter := (images.Overlay $logo 50 50 ) }}
 +{{ $img := $img | images.Filter $logoFilter }}
 +```
 +
 +A shorter version of the above, if you only need to apply the filter once:
 +
 +```go-html-template
 +{{ $img := $img.Filter (images.Overlay $logo 50 50 )}}
 +```
 +
 +The above will overlay `$logo` in the upper left corner of `$img` (at position `x=50, y=50`).
 +
- ### Brightness
++## Text
 +
 +{{< new-in "0.90.0" >}}
 +
 +Using the `Text` filter, you can add text to an image.
 +
 +{{% funcsig %}}
 +images.Text TEXT DICT)
 +{{% /funcsig %}}
 +
 +The following example will add the text `Hugo rocks!` to the image with the specified color, size and position.
 +
 +```go-html-template
 +{{ $img := resources.Get "/images/background.png"}}
 +{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
 +    "color" "#ffffff"
 +    "size" 60
 +    "linespacing" 2
 +    "x" 10
 +    "y" 20
 +))}}
 +```
 +
 +You can load a custom font if needed. Load the font as a Hugo `Resource` and set it as an option:
 +
 +```go-html-template
 +
 +{{ $font := resources.Get "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Black.ttf" }}
 +{{ $img := resources.Get "/images/background.png"}}
 +{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
 +    "font" $font
 +))}}
 +```
 +
 +
- ### Colorize
++## Brightness
 +
 +{{% funcsig %}}
 +images.Brightness PERCENTAGE
 +{{% /funcsig %}}
 +
 +Brightness creates a filter that changes the brightness of an image.
 +The percentage parameter must be in range (-100, 100).
 +
 +### ColorBalance
 +
 +{{% funcsig %}}
 +images.ColorBalance PERCENTAGERED PERCENTAGEGREEN PERCENTAGEBLUE
 +{{% /funcsig %}}
 +
 +ColorBalance creates a filter that changes the color balance of an image.
 +The percentage parameters for each color channel (red, green, blue) must be in range (-100, 500).
 +
- ### Contrast
++## Colorize
 +
 +{{% funcsig %}}
 +images.Colorize HUE SATURATION PERCENTAGE
 +{{% /funcsig %}}
 +
 +Colorize creates a filter that produces a colorized version of an image.
 +The hue parameter is the angle on the color wheel, typically in range (0, 360).
 +The saturation parameter must be in range (0, 100).
 +The percentage parameter specifies the strength of the effect, it must be in range (0, 100).
 +
- ### Gamma
++## Contrast
 +
 +{{% funcsig %}}
 +images.Contrast PERCENTAGE
 +{{% /funcsig %}}
 +
 +Contrast creates a filter that changes the contrast of an image.
 +The percentage parameter must be in range (-100, 100).
 +
- ### GaussianBlur
++## Gamma
 +
 +{{% funcsig %}}
 +images.Gamma GAMMA
 +{{% /funcsig %}}
 +
 +Gamma creates a filter that performs a gamma correction on an image.
 +The gamma parameter must be positive. Gamma = 1 gives the original image.
 +Gamma less than 1 darkens the image and gamma greater than 1 lightens it.
 +
- ### Hue
++## GaussianBlur
 +
 +{{% funcsig %}}
 +images.GaussianBlur SIGMA
 +{{% /funcsig %}}
 +
 +GaussianBlur creates a filter that applies a gaussian blur to an image.
 +
 +### Grayscale
 +
 +{{% funcsig %}}
 +images.Grayscale
 +{{% /funcsig %}}
 +
 +Grayscale creates a filter that produces a grayscale version of an image.
 +
- ### Invert
++## Hue
 +
 +{{% funcsig %}}
 +images.Hue SHIFT
 +{{% /funcsig %}}
 +
 +Hue creates a filter that rotates the hue of an image.
 +The hue angle shift is typically in range -180 to 180.
 +
- ### Pixelate
++## Invert
 +
 +{{% funcsig %}}
 +images.Invert
 +{{% /funcsig %}}
 +
 +Invert creates a filter that negates the colors of an image.
 +
- ### Saturation
++## Pixelate
 +
 +{{% funcsig %}}
 +images.Pixelate SIZE
 +{{% /funcsig %}}
 +
 +Pixelate creates a filter that applies a pixelation effect to an image.
 +
- ### Sepia
++## Saturation
 +
 +{{% funcsig %}}
 +images.Saturation PERCENTAGE
 +{{% /funcsig %}}
 +
 +Saturation creates a filter that changes the saturation of an image.
 +
- ### Sigmoid
++## Sepia
 +
 +{{% funcsig %}}
 +images.Sepia PERCENTAGE
 +{{% /funcsig %}}
 +
 +Sepia creates a filter that produces a sepia-toned version of an image.
 +
- ### UnsharpMask
++## Sigmoid
 +
 +{{% funcsig %}}
 +images.Sigmoid MIDPOINT FACTOR
 +{{% /funcsig %}}
 +
 +Sigmoid creates a filter that changes the contrast of an image using a sigmoidal function and returns the adjusted image.
 +It's a non-linear contrast change useful for photo adjustments as it preserves highlight and shadow detail.
 +
++## UnsharpMask
 +
 +{{% funcsig %}}
 +images.UnsharpMask SIGMA AMOUNT THRESHOLD
 +{{% /funcsig %}}
 +
 +UnsharpMask creates a filter that sharpens an image.
 +The sigma parameter is used in a gaussian function and affects the radius of effect.
 +Sigma must be positive. Sharpen radius roughly equals 3 * sigma.
 +The amount parameter controls how much darker and how much lighter the edge borders become. Typically between 0.5 and 1.5.
 +The threshold parameter controls the minimum brightness change that will be sharpened. Typically between 0 and 0.05.
 +
 +## Other Functions
 +
 +### Filter
 +
 +{{% funcsig %}}
 +IMAGE | images.Filter FILTERS...
 +{{% /funcsig %}}
 +
 +Can be used to apply a set of filters to an image:
 +
 +```go-html-template
 +{{ $img := $img | images.Filter (images.GaussianBlur 6) (images.Pixelate 8) }}
 +```
 +
 +Also see the [Filter Method](/content-management/image-processing/#filter).
 +
 +### ImageConfig
 +
 +Parses the image and returns the height, width, and color model.
 +
 +{{% funcsig %}}
 +images.ImageConfig PATH
 +{{% /funcsig %}}
 +
 +```go-html-template
 +{{ with (imageConfig "favicon.ico") }}
 +favicon.ico: {{.Width}} x {{.Height}}
 +{{ end }}
 +```
index d097dec6b9e190006c6568253d286e3179b96e7a,0000000000000000000000000000000000000000..7cace938a71d9c1cb11d583c1450ea9719a8eecb
mode 100755,000000..100755
--- /dev/null
@@@ -1,101 -1,0 +1,120 @@@
- ### Asset directory
 +---
 +title: Hugo Pipes Introduction
++linkTitle: Hugo Pipes
 +description: Hugo Pipes is Hugo's asset processing set of functions.
 +date: 2018-07-14
 +publishdate: 2018-07-14
 +lastmod: 2018-07-14
 +categories: [asset management]
 +keywords: []
 +menu:
 +  docs:
 +    parent: "pipes"
 +    weight: 20
 +weight: 01
 +sections_weight: 01
 +draft: false
++toc: true
 +aliases: [/assets/]
 +---
 +
- Asset files must be stored in the asset directory. This is `/assets` by default, but can be configured via the configuration file's `assetDir` key.
++## Get Resource with resources.Get
 +
- ### From file or URL to resource
++In order to process an asset with Hugo Pipes, it must be retrieved as a `Resource` using `resources.Get`. The first argument can be either a local the path to file relative to the `asset` directory/directories or a remote URL.
++
++```go-html-template
++{{ $local := resources.Get "sass/main.scss" }}
++{{ $remote := resources.Get "https://www.example.com/styles.scss" }}
++```
 +
- In order to process an asset with Hugo Pipes, it must be retrieved as a resource using `resources.Get`. The first argument can be the filepath of the file relative to the asset directory or the URL of the file.
++`resources.Get` will always return `nil` if the resource could not be found.
 +
- {{ $style := resources.Get "sass/main.scss" }}
- {{ $remoteStyle := resources.Get "https://www.example.com/styles.scss" }}
++### Error Handling
++
++{{< new-in "0.90.1" >}}
++
++The return value from `resources.Get` includes an `.Err` method that will return an error if the call failed. If you want to just log any error as a `WARNING` you can use a construct similar to the one below.
 +
 +```go-html-template
- #### Request options
++{{ with resources.Get "https://gohugo.io/images/gohugoio-card-1.png" }}
++  {{ with .Err }}
++    {{ warnf "%s" . }}
++  {{ else }}
++    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
++  {{ end }}
++{{ end }}
 +```
 +
- When using an URL, the `resources.Get` function takes an optional options map as the last argument, e.g.:
++Note that if you do not handle `.Err` yourself, Hugo will fail the build the first time you start using the `Resource` object.
 +
- ```
++### Remote Options
 +
- ```
++When fetching a remote `Resource`, `resources.Get` takes an optional options map as the last argument, e.g.:
++
++```go-html-template
 +{{ $resource := resources.Get "https://example.org/api" (dict "headers" (dict "Authorization" "Bearer abcd"))  }}
 +```
 +
 +If you need multiple values for the same header key, use a slice:
 +
- ```
++```go-html-template
 +{{ $resource := resources.Get "https://example.org/api"  (dict "headers" (dict "X-List" (slice "a" "b" "c")))  }}
 +```
 +
 +You can also change the request method and set the request body:
 +
- #### Cache of remote resources
++```go-html-template
 +{{ $postResponse := resources.Get "https://example.org/api"  (dict 
 +    "method" "post"
 +    "body" `{"complete": true}` 
 +    "headers" (dict 
 +        "Content-Type" "application/json"
 +    )
 +)}}
 +```
 +
- Each downloaded URL will be cached in the default folder `$TMPDIR/hugo_cache/`. The variable `$TMPDIR` will be resolved to your system-dependent temporary directory.
++### Caching of Remote Resources
 +
- With the command-line flag `--cacheDir`, you can specify any folder on your system as a caching directory.
++Remote resources fetched with `resources.Get` will be cached on disk. See [Configure File Caches](/getting-started/configuration/#configure-file-caches) for details.
 +
- You can also set `cacheDir` or `caches.getresource` in the [main configuration file][config].
++## Asset directory
 +
- If you don't like caching at all, you can fully disable caching with the command line flag `--ignoreCache`.
++Asset files must be stored in the asset directory. This is `/assets` by default, but can be configured via the configuration file's `assetDir` key.
 +
- ### Asset publishing
 +
- Assets will only be published (to `/public`) if `.Permalink` or `.RelPermalink` is used.
++### Asset Publishing
 +
- ### Go Pipes
++Assets will only be published (to `/public`) if `.Permalink` or `.RelPermalink` is used. You can use `.Content` to inline the asset.
 +
- ### Method aliases
++## Go Pipes
 +
 +For improved readability, the Hugo Pipes examples of this documentation will be written using [Go Pipes](/templates/introduction/#pipes):
++
 +```go-html-template
 +{{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
 +<link rel="stylesheet" href="{{ $style.Permalink }}">
 +```
 +
- ### Caching
++## Method aliases
 +
 +Each Hugo Pipes `resources` transformation method uses a __camelCased__ alias (`toCSS` for `resources.ToCSS`).
 +Non-transformation methods deprived of such aliases are `resources.Get`, `resources.FromString`, `resources.ExecuteAsTemplate` and `resources.Concat`.
 +
 +The example above can therefore also be written as follows:
++
 +```go-html-template
 +{{ $style := resources.Get "sass/main.scss" | toCSS | minify | fingerprint }}
 +<link rel="stylesheet" href="{{ $style.Permalink }}">
 +```
 +
++## Caching
 +
 +Hugo Pipes invocations are cached based on the entire _pipe chain_.
 +
 +An example of a pipe chain is:
 +
 +```go-html-template
 +{{ $mainJs := resources.Get "js/main.js" | js.Build "main.js" | minify | fingerprint }}
 +```
 +
 +The pipe chain is only invoked the first time it is encountered in a site build, and results are otherwise loaded from cache. As such, Hugo Pipes can be used in templates which are executed thousands or millions of times without negatively impacting the build performance.
index c02f38fa819b91ec1e6b2fe08fe2bcda2ffc9674,0000000000000000000000000000000000000000..751ed3f29b4b642300f120c5039aba915cfe8af3
mode 100644,000000..100644
--- /dev/null
@@@ -1,698 -1,0 +1,698 @@@
- linktitle: Introduction
 +---
 +title: Introduction to Hugo Templating
++linktitle: Templating
 +description: Hugo uses Go's `html/template` and `text/template` libraries as the basis for the templating.
 +date: 2017-02-01
 +publishdate: 2017-02-01
 +lastmod: 2017-02-25
 +categories: [templates,fundamentals]
 +keywords: [go]
 +menu:
 +  docs:
 +    parent: "templates"
 +    weight: 10
 +weight: 10
 +sections_weight: 10
 +draft: false
 +aliases: [/layouts/introduction/,/layout/introduction/, /templates/go-templates/]
 +toc: true
 +---
 +
 +{{% note %}}
 +The following is only a primer on Go Templates. For an in-depth look into Go Templates, check the official [Go docs](https://golang.org/pkg/text/template/).
 +{{% /note %}}
 +
 +Go Templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer.
 +
 +## Basic Syntax
 +
 +Go Templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go Template variables and functions are accessible within `{{ }}`.
 +
 +### Access a Predefined Variable
 +
 +A _predefined variable_ could be a variable already existing in the
 +current scope (like the `.Title` example in the [Variables]({{< relref
 +"#variables" >}}) section below) or a custom variable (like the
 +`$address` example in that same section).
 +
 +
 +```go-html-template
 +{{ .Title }}
 +{{ $address }}
 +```
 +
 +Parameters for functions are separated using spaces. The general syntax is:
 +
 +```
 +{{ FUNCTION ARG1 ARG2 .. }}
 +```
 +
 +The following example calls the `add` function with inputs of `1` and `2`:
 +
 +```go-html-template
 +{{ add 1 2 }}
 +```
 +
 +#### Methods and Fields are Accessed via dot Notation
 +
 +Accessing the Page Parameter `bar` defined in a piece of content's [front matter][].
 +
 +```go-html-template
 +{{ .Params.bar }}
 +```
 +
 +#### Parentheses Can be Used to Group Items Together
 +
 +```go-html-template
 +{{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }}
 +```
 +
 +#### A Single Statement Can be Split over Multiple Lines
 +
 +```go-html-template
 +{{ if or 
 +  (isset .Params "alt") 
 +  (isset .Params "caption")
 +}}
 +```
 +
 +#### Raw String Literals Can Include Newlines
 +
 +```go-html-template
 +{{ $msg := `Line one.
 +Line two.` }}
 +```
 +
 +## Variables {#variables}
 +
 +Each Go Template gets a data object. In Hugo, each template is passed
 +a `Page`.  In the below example, `.Title` is one of the elements
 +accessible in that [`Page` variable][pagevars].
 +
 +With the `Page` being the default scope of a template, the `Title`
 +element in current scope (`.` -- "the **dot**") is accessible simply
 +by the dot-prefix (`.Title`):
 +
 +```go-html-template
 +<title>{{ .Title }}</title>
 +```
 +
 +Values can also be stored in custom variables and referenced later:
 +
 +{{% note %}}
 +The custom variables need to be prefixed with `$`.
 +{{% /note %}}
 +
 +```go-html-template
 +{{ $address := "123 Main St." }}
 +{{ $address }}
 +```
 +
 +{{% warning %}}
 +For Hugo v0.47 and older versions, variables defined inside `if`
 +conditionals and similar are not visible on the outside.
 +See [https://github.com/golang/go/issues/10608](https://github.com/golang/go/issues/10608).
 +
 +Hugo has created a workaround for this issue in [Scratch](/functions/scratch).
 +{{% /warning %}}
 +
 +For **Hugo v0.48** and newer, variables can be re-defined using the
 +new `=` operator (new in Go 1.11).
 +
 +Below example will work only in these newer Hugo versions. The example
 +prints "Var is Hugo Home" on the home page, and "Var is Hugo Page" on
 +all other pages:
 +
 +```go-html-template
 +{{ $var := "Hugo Page" }}
 +{{ if .IsHome }}
 +    {{ $var = "Hugo Home" }}
 +{{ end }}
 +Var is {{ $var }}
 +```
 +
 +## Functions
 +
 +Go Templates only ship with a few basic functions but also provide a mechanism for applications to extend the original set.
 +
 +[Hugo template functions][functions] provide additional functionality specific to building websites. Functions are called by using their name followed by the required parameters separated by spaces. Template functions cannot be added without recompiling Hugo.
 +
 +### Example 1: Adding Numbers
 +
 +```go-html-template
 +{{ add 1 2 }}
 +<!-- prints 3 -->
 +```
 +
 +### Example 2: Comparing Numbers
 +
 +```go-html-template
 +{{ lt 1 2 }}
 +<!-- prints true (i.e., since 1 is less than 2) -->
 +```
 +
 +Note that both examples make use of Go Template's [math]][] functions.
 +
 +{{% note "Additional Boolean Operators" %}}
 +There are more boolean operators than those listed in the Hugo docs in the [Go Template documentation](https://golang.org/pkg/text/template/#hdr-Functions).
 +{{% /note %}}
 +
 +## Includes
 +
 +When including another template, you will need to pass it the data that it would
 +need to access.
 +
 +{{% note %}}
 +To pass along the current context, please remember to include a trailing **dot**.
 +{{% /note %}}
 +
 +The templates location will always be starting at the `layouts/` directory
 +within Hugo.
 +
 +### Partial
 +
 +The [`partial`][partials] function is used to include *partial* templates using
 +the syntax `{{ partial "<PATH>/<PARTIAL>.<EXTENSION>" . }}`.
 +
 +Example of including a `layouts/partials/header.html` partial:
 +
 +```go-html-template
 +{{ partial "header.html" . }}
 +```
 +
 +### Template
 +
 +The `template` function was used to include *partial* templates
 +in much older Hugo versions. Now it's useful only for calling
 +[*internal* templates][internal templates]. The syntax is `{{ template
 +"_internal/<TEMPLATE>.<EXTENSION>" . }}`.
 +
 +{{% note %}}
 +The available **internal** templates can be found
 +[here](https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates).
 +{{% /note %}}
 +
 +Example of including the internal `opengraph.html` template:
 +
 +```go-html-template
 +{{ template "_internal/opengraph.html" . }}
 +```
 +
 +## Logic
 +
 +Go Templates provide the most basic iteration and conditional logic.
 +
 +### Iteration
 +
 +The Go Templates make heavy use of `range` to iterate over a _map_,
 +_array_, or _slice_. The following are different examples of how to
 +use `range`.
 +
 +#### Example 1: Using Context (`.`)
 +
 +```go-html-template
 +{{ range $array }}
 +    {{ . }} <!-- The . represents an element in $array -->
 +{{ end }}
 +```
 +
 +#### Example 2: Declaring a variable name for an array element's value
 +
 +```go-html-template
 +{{ range $elem_val := $array }}
 +    {{ $elem_val }}
 +{{ end }}
 +```
 +
 +#### Example 3: Declaring variable names for an array element's index _and_ value
 +
 +For an array or slice, the first declared variable will map to each
 +element's index.
 +
 +```go-html-template
 +{{ range $elem_index, $elem_val := $array }}
 +   {{ $elem_index }} -- {{ $elem_val }}
 +{{ end }}
 +```
 +
 +#### Example 4: Declaring variable names for a map element's key _and_ value
 +
 +For a map, the first declared variable will map to each map element's
 +key.
 +
 +```go-html-template
 +{{ range $elem_key, $elem_val := $map }}
 +   {{ $elem_key }} -- {{ $elem_val }}
 +{{ end }}
 +```
 +
 +#### Example 5: Conditional on empty _map_, _array_, or _slice_.
 +
 +If the _map_, _array_, or _slice_ passed into the range is zero-length then the else statement is evaluated.
 +
 +```go-html-template
 +{{ range $array }}
 +    {{ . }}
 +{{else}}
 +    <!-- This is only evaluated if $array is empty -->
 +{{ end }}
 +```
 +
 +### Conditionals
 +
 +`if`, `else`, `with`, `or`, `and` and `not` provide the framework for handling conditional logic in Go Templates. Like `range`, `if` and `with` statements are closed with an `{{ end }}`.
 +
 +Go Templates treat the following values as **false**:
 +
 +- `false` (boolean)
 +- 0 (integer)
 +- any zero-length array, slice, map, or string
 +
 +#### Example 1: `with`
 +
 +It is common to write "if something exists, do this" kind of
 +statements using `with`.
 +
 +{{% note %}}
 +`with` rebinds the context `.` within its scope (just like in `range`).
 +{{% /note %}}
 +
 +It skips the block if the variable is absent, or if it evaluates to
 +"false" as explained above.
 +
 +```go-html-template
 +{{ with .Params.title }}
 +    <h4>{{ . }}</h4>
 +{{ end }}
 +```
 +
 +#### Example 2: `with` .. `else`
 +
 +Below snippet uses the "description" front-matter parameter's value if
 +set, else uses the default `.Summary` [Page variable][pagevars]:
 +
 +
 +```go-html-template
 +{{ with .Param "description" }}
 +    {{ . }}
 +{{ else }}
 +    {{ .Summary }}
 +{{ end }}
 +```
 +
 +See the [`.Param` function][param].
 +
 +#### Example 3: `if`
 +
 +An alternative (and a more verbose) way of writing `with` is using
 +`if`. Here, the `.` does not get rebinded.
 +
 +Below example is "Example 1" rewritten using `if`:
 +
 +```go-html-template
 +{{ if isset .Params "title" }}
 +    <h4>{{ index .Params "title" }}</h4>
 +{{ end }}
 +```
 +
 +#### Example 4: `if` .. `else`
 +
 +Below example is "Example 2" rewritten using `if` .. `else`, and using
 +[`isset` function][isset] + `.Params` variable (different from the
 +[`.Param` **function**][param]) instead:
 +
 +```go-html-template
 +{{ if (isset .Params "description") }}
 +    {{ index .Params "description" }}
 +{{ else }}
 +    {{ .Summary }}
 +{{ end }}
 +```
 +
 +#### Example 5: `if` .. `else if` .. `else`
 +
 +Unlike `with`, `if` can contain `else if` clauses too.
 +
 +```go-html-template
 +{{ if (isset .Params "description") }}
 +    {{ index .Params "description" }}
 +{{ else if (isset .Params "summary") }}
 +    {{ index .Params "summary" }}
 +{{ else }}
 +    {{ .Summary }}
 +{{ end }}
 +```
 +
 +#### Example 6: `and` & `or`
 +
 +```go-html-template
 +{{ if (and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")) }}
 +```
 +
 +## Pipes
 +
 +One of the most powerful components of Go Templates is the ability to stack actions one after another. This is done by using pipes. Borrowed from Unix pipes, the concept is simple: each pipeline's output becomes the input of the following pipe.
 +
 +Because of the very simple syntax of Go Templates, the pipe is essential to being able to chain together function calls. One limitation of the pipes is that they can only work with a single value and that value becomes the last parameter of the next pipeline.
 +
 +A few simple examples should help convey how to use the pipe.
 +
 +### Example 1: `shuffle`
 +
 +The following two examples are functionally the same:
 +
 +```go-html-template
 +{{ shuffle (seq 1 5) }}
 +```
 +
 +
 +```go-html-template
 +{{ (seq 1 5) | shuffle }}
 +```
 +
 +### Example 2: `index`
 +
 +The following accesses the page parameter called "disqus_url" and escapes the HTML. This example also uses the [`index` function](/functions/index-function/), which is built into Go Templates:
 +
 +```go-html-template
 +{{ index .Params "disqus_url" | html }}
 +```
 +
 +### Example 3: `or` with `isset`
 +
 +```go-html-template
 +{{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr") }}
 +Stuff Here
 +{{ end }}
 +```
 +
 +Could be rewritten as
 +
 +```go-html-template
 +{{ if isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" }}
 +Stuff Here
 +{{ end }}
 +```
 +
 +### Example 4: Internet Explorer Conditional Comments {#ie-conditional-comments}
 +
 +By default, Go Templates remove HTML comments from output. This has the unfortunate side effect of removing Internet Explorer conditional comments. As a workaround, use something like this:
 +
 +```go-html-template
 +{{ "<!--[if lt IE 9]>" | safeHTML }}
 +  <script src="html5shiv.js"></script>
 +{{ "<![endif]-->" | safeHTML }}
 +```
 +
 +Alternatively, you can use the backtick (`` ` ``) to quote the IE conditional comments, avoiding the tedious task of escaping every double quotes (`"`) inside, as demonstrated in the [examples](https://golang.org/pkg/text/template/#hdr-Examples) in the Go text/template documentation:
 +
 +```go-html-template
 +{{ `<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->` | safeHTML }}
 +```
 +
 +## Context (aka "the dot") {#the-dot}
 +
 +The most easily overlooked concept to understand about Go Templates is
 +that `{{ . }}` always refers to the **current context**.
 +
 +- In the top level of your template, this will be the data set made
 +  available to it.
 +- Inside of an iteration, however, it will have the value of the
 +  current item in the loop; i.e., `{{ . }}` will no longer refer to
 +  the data available to the entire page.
 +
 +If you need to access page-level data (e.g., page params set in front
 +matter) from within the loop, you will likely want to do one of the
 +following:
 +
 +### 1. Define a Variable Independent of Context
 +
 +The following shows how to define a variable independent of the context.
 +
 +{{< code file="tags-range-with-page-variable.html" >}}
 +{{ $title := .Site.Title }}
 +<ul>
 +{{ range .Params.tags }}
 +    <li>
 +        <a href="/tags/{{ . | urlize }}">{{ . }}</a>
 +        - {{ $title }}
 +    </li>
 +{{ end }}
 +</ul>
 +{{< /code >}}
 +
 +{{% note %}}
 +Notice how once we have entered the loop (i.e. `range`), the value of `{{ . }}` has changed. We have defined a variable outside of the loop (`{{$title}}`) that we've assigned a value so that we have access to the value from within the loop as well.
 +{{% /note %}}
 +
 +### 2. Use `$.` to Access the Global Context
 +
 +`$` has special significance in your templates. `$` is set to the starting value of `.` ("the dot") by default. This is a [documented feature of Go text/template][dotdoc]. This means you have access to the global context from anywhere. Here is an equivalent example of the preceding code block but now using `$` to grab `.Site.Title` from the global context:
 +
 +{{< code file="range-through-tags-w-global.html" >}}
 +<ul>
 +{{ range .Params.tags }}
 +  <li>
 +    <a href="/tags/{{ . | urlize }}">{{ . }}</a>
 +            - {{ $.Site.Title }}
 +  </li>
 +{{ end }}
 +</ul>
 +{{< /code >}}
 +
 +{{% warning "Don't Redefine the Dot" %}}
 +The built-in magic of `$` would cease to work if someone were to mischievously redefine the special character; e.g. `{{ $ := .Site }}`. *Don't do it.* You may, of course, recover from this mischief by using `{{ $ := . }}` in a global context to reset `$` to its default value.
 +{{% /warning %}}
 +
 +## Whitespace
 +
 +Go 1.6 includes the ability to trim the whitespace from either side of a Go tag by including a hyphen (`-`) and space immediately beside the corresponding `{{` or `}}` delimiter.
 +
 +For instance, the following Go Template will include the newlines and horizontal tab in its HTML output:
 +
 +```go-html-template
 +<div>
 +  {{ .Title }}
 +</div>
 +```
 +
 +Which will output:
 +
 +```html
 +<div>
 +  Hello, World!
 +</div>
 +```
 +
 +Leveraging the `-` in the following example will remove the extra white space surrounding the `.Title` variable and remove the newline:
 +
 +```go-html-template
 +<div>
 +  {{- .Title -}}
 +</div>
 +```
 +
 +Which then outputs:
 +
 +```html
 +<div>Hello, World!</div>
 +```
 +
 +Go considers the following characters _whitespace_:
 +
 +* <kbd>space</kbd>
 +* horizontal <kbd>tab</kbd>
 +* carriage <kbd>return</kbd>
 +* newline
 +
 +## Comments
 +
 +In order to keep your templates organized and share information throughout your team, you may want to add comments to your templates. There are two ways to do that with Hugo.
 +
 +### Go Templates comments
 +
 +Go Templates support `{{/*` and `*/}}` to open and close a comment block. Nothing within that block will be rendered.
 +
 +For example:
 +
 +```go-html-template
 +Bonsoir, {{/* {{ add 0 + 2 }} */}}Eliott.
 +```
 +
 +Will render `Bonsoir, Eliott.`, and not care about the syntax error (`add 0 + 2`) in the comment block.
 +
 +### HTML comments
 +
 +If you need to produce HTML comments from your templates, take a look at the [Internet Explorer conditional comments](#ie-conditional-comments) example. If you need variables to construct such HTML comments, just pipe `printf` to `safeHTML`. For example:
 +
 +```go-html-template
 +{{ printf "<!-- Our website is named: %s -->" .Site.Title | safeHTML }}
 +```
 +
 +#### HTML comments containing Go Templates
 +
 +HTML comments are by default stripped, but their content is still evaluated. That means that although the HTML comment will never render any content to the final HTML pages, code contained within the comment may fail the build process.
 +
 +{{% note %}}
 +Do **not** try to comment out Go Template code using HTML comments.
 +{{% /note %}}
 +
 +```go-html-template
 +<!-- {{ $author := "Emma Goldman" }} was a great woman. -->
 +{{ $author }}
 +```
 +
 +The templating engine will strip the content within the HTML comment, but will first evaluate any Go Template code if present within. So the above example will render `Emma Goldman`, as the `$author` variable got evaluated in the HTML comment. But the build would have failed if that code in the HTML comment had an error.
 +
 +## Hugo Parameters
 +
 +Hugo provides the option of passing values to your template layer through your [site configuration][config] (i.e. for site-wide values) or through the metadata of each specific piece of content (i.e. the [front matter][]). You can define any values of any type and use them however you want in your templates, as long as the values are supported by the [front matter format]({{< ref "front-matter.md#front-matter-formats" >}}).
 +
 +## Use Content (`Page`) Parameters
 +
 +You can provide variables to be used by templates in individual content's [front matter][].
 +
 +An example of this is used in the Hugo docs. Most of the pages benefit from having the table of contents provided, but sometimes the table of contents doesn't make a lot of sense. We've defined a `notoc` variable in our front matter that will prevent a table of contents from rendering when specifically set to `true`.
 +
 +Here is the example front matter (YAML):
 +
 +```
 +---
 +title: Roadmap
 +lastmod: 2017-03-05
 +date: 2013-11-18
 +notoc: true
 +---
 +```
 +
 +Here is an example of corresponding code that could be used inside a `toc.html` [partial template][partials]:
 +
 +{{< code file="layouts/partials/toc.html" download="toc.html" >}}
 +{{ if not .Params.notoc }}
 +<aside>
 +  <header>
 +    <a href="#{{.Title | urlize}}">
 +    <h3>{{.Title}}</h3>
 +    </a>
 +  </header>
 +  {{.TableOfContents}}
 +</aside>
 +<a href="#" id="toc-toggle"></a>
 +{{ end }}
 +{{< /code >}}
 +
 +We want the *default* behavior to be for pages to include a TOC unless otherwise specified. This template checks to make sure that the `notoc:` field in this page's front matter is not `true`.
 +
 +## Use Site Configuration Parameters
 +
 +You can arbitrarily define as many site-level parameters as you want in your [site's configuration file][config]. These parameters are globally available in your templates.
 +
 +For instance, you might declare the following:
 +
 +{{< code-toggle file="config" >}}
 +params:
 +  copyrighthtml: "Copyright &#xA9; 2017 John Doe. All Rights Reserved."
 +  twitteruser: "spf13"
 +  sidebarrecentlimit: 5
 +{{< /code >}}
 +
 +Within a footer layout, you might then declare a `<footer>` that is only rendered if the `copyrighthtml` parameter is provided. If it *is* provided, you will then need to declare the string is safe to use via the [`safeHTML` function][safehtml] so that the HTML entity is not escaped again. This would let you easily update just your top-level config file each January 1st, instead of hunting through your templates.
 +
 +```go-html-template
 +{{ if .Site.Params.copyrighthtml }}
 +    <footer>
 +        <div class="text-center">{{.Site.Params.CopyrightHTML | safeHTML}}</div>
 +    </footer>
 +{{ end }}
 +```
 +
 +An alternative way of writing the "`if`" and then referencing the same value is to use [`with`][with] instead. `with` rebinds the context (`.`) within its scope and skips the block if the variable is absent:
 +
 +{{< code file="layouts/partials/twitter.html" >}}
 +{{ with .Site.Params.twitteruser }}
 +    <div>
 +        <a href="https://twitter.com/{{.}}" rel="author">
 +        <img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}" alt="Twitter"></a>
 +    </div>
 +{{ end }}
 +{{< /code >}}
 +
 +Finally, you can pull "magic constants" out of your layouts as well. The following uses the [`first`][first] function, as well as the [`.RelPermalink`][relpermalink] page variable and the [`.Site.Pages`][sitevars] site variable.
 +
 +```go-html-template
 +<nav>
 +  <h1>Recent Posts</h1>
 +  <ul>
 +  {{- range first .Site.Params.SidebarRecentLimit .Site.Pages -}}
 +      <li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
 +  {{- end -}}
 +  </ul>
 +</nav>
 +```
 +
 +## Example: Show Future Events
 +
 +Given the following content structure and [front matter]:
 +
 +```text
 +content/
 +└── events/
 +    ├── event-1.md
 +    ├── event-2.md
 +    └── event-3.md
 +```
 +
 +{{< code-toggle file="content/events/event-1.md" copy="false" >}}
 +title = 'Event 1'
 +date = 2021-12-06T10:37:16-08:00
 +draft = false
 +start_date = 2021-12-05T09:00:00-08:00
 +end_date = 2021-12-05T11:00:00-08:00
 +{{< /code-toggle >}}
 +
 +This [partial template][partials] renders future events:
 +
 +{{< code file="layouts/partials/future-events.html" >}}
 +<h2>Future Events</h2>
 +<ul>
 +  {{ range where site.RegularPages "Type" "events" }}
 +    {{ if gt (.Params.start_date | time.AsTime) now }}
 +      {{ $startDate := .Params.start_date | time.Format ":date_medium" }}
 +      <li>
 +        <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> - {{ $startDate }}
 +      </li>
 +    {{ end }}
 +  {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +If you restrict front matter to the TOML format, and omit quotation marks surrounding date fields, you can perform date comparisons without casting.
 +
 +{{< code file="layouts/partials/future-events.html" >}}
 +<h2>Future Events</h2>
 +<ul>
 +  {{ range where (where site.RegularPages "Type" "events") "Params.start_date" "gt" now }}
 +    {{ $startDate := .Params.start_date | time.Format ":date_medium" }}
 +    <li>
 +      <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> - {{ $startDate }}
 +    </li>
 +  {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +[config]: {{< relref "getting-started/configuration" >}}
 +[dotdoc]: https://golang.org/pkg/text/template/#hdr-Variables
 +[first]: {{< relref "functions/first" >}}
 +[front matter]: {{< relref "content-management/front-matter" >}}
 +[functions]: {{< relref "functions" >}}
 +[internal templates]: {{< relref "templates/internal" >}}
 +[isset]: {{< relref "functions/isset" >}}
 +[math]: {{< relref "functions/math" >}}
 +[pagevars]: {{< relref "variables/page" >}}
 +[param]: {{< relref "functions/param" >}}
 +[partials]: {{< relref "templates/partials" >}}
 +[relpermalink]: {{< relref "variables/page#page-variables" >}}
 +[safehtml]: {{< relref "functions/safehtml" >}}
 +[sitevars]: {{< relref "variables/site" >}}
 +[variables]: {{< relref "variables" >}}
 +[with]: {{< relref "functions/with" >}}
index be9df664cf0304a958d34294f90b7e87ca6c0e03,0000000000000000000000000000000000000000..2c0e383fbb792e7c0156db97dbc9868525d8ba3f
mode 100644,000000..100644
--- /dev/null
@@@ -1,593 -1,0 +1,593 @@@
- linktitle: List Page Templates
 +---
 +title: Lists of Content in Hugo
++linktitle: List Templates
 +description: Lists have a specific meaning and usage in Hugo when it comes to rendering your site homepage, section page, taxonomy list, or taxonomy terms list.
 +date: 2017-02-01
 +publishdate: 2017-02-01
 +lastmod: 2017-02-01
 +categories: [templates]
 +keywords: [lists,sections,rss,taxonomies,terms]
 +menu:
 +  docs:
 +    parent: "templates"
 +    weight: 22
 +weight: 22
 +sections_weight: 22
 +draft: false
 +aliases: [/templates/list/,/layout/indexes/]
 +toc: true
 +---
 +
 +## What is a List Page Template?
 +
 +{{< youtube 8b2YTSMdMps >}}
 +
 +A list page template is a template used to render multiple pieces of content in a single HTML page. The exception to this rule is the homepage, which is still a list but has its own [dedicated template][homepage].
 +
 +Hugo uses the term *list* in its truest sense; i.e. a sequential arrangement of material, especially in alphabetical or numerical order. Hugo uses list templates on any output HTML page where content is traditionally listed:
 +
 +* [Taxonomy terms pages][taxterms]
 +* [Taxonomy list pages][taxlists]
 +* [Section list pages][sectiontemps]
 +* [RSS][rss]
 +
 +For template lookup order, see [Template Lookup](/templates/lookup-order/).
 +
 +The idea of a list page comes from the [hierarchical mental model of the web][mentalmodel] and is best demonstrated visually:
 +
 +[![Image demonstrating a hierarchical website sitemap.](/images/site-hierarchy.svg)](/images/site-hierarchy.svg)
 +
 +## List Defaults
 +
 +### Default Templates
 +
 +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`.
 +
 +See [Template Lookup Order](/templates/lookup-order/) for the complete reference.
 +
 +## Add Content and Front Matter to List Pages
 +
 +Since v0.18, [everything in Hugo is a `Page`][bepsays]. This means list pages and the homepage can have associated content files (i.e. `_index.md`) that contain page metadata (i.e., front matter) and content.
 +
 +This new model allows you to include list-specific front matter via `.Params` and also means that list templates (e.g., `layouts/_default/list.html`) have access to all [page variables][pagevars].
 +
 +{{% note %}}
 +It is important to note that all `_index.md` content files will render according to a *list* template and not according to a [single page template](/templates/single-page-templates/).
 +{{% /note %}}
 +
 +### Example Project Directory
 +
 +The following is an example of a typical Hugo project directory's content:
 +
 +```
 +.
 +...
 +├── content
 +|   ├── posts
 +|   |   ├── _index.md
 +|   |   ├── post-01.md
 +|   |   └── post-02.md
 +|   └── quote
 +|   |   ├── quote-01.md
 +|   |   └── quote-02.md
 +...
 +```
 +
 +Using the above example, let's assume you have the following in `content/posts/_index.md`:
 +
 +{{< code file="content/posts/_index.md" >}}
 +---
 +title: My Go Journey
 +date: 2017-03-23
 +publishdate: 2017-03-24
 +---
 +
 +I decided to start learning Go in March 2017.
 +
 +Follow my journey through this new blog.
 +{{< /code >}}
 +
 +You can now access this `_index.md`'s' content in your list template:
 +
 +{{< code file="layouts/_default/list.html" download="list.html" >}}
 +{{ define "main" }}
 +<main>
 +    <article>
 +        <header>
 +            <h1>{{.Title}}</h1>
 +        </header>
 +        <!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
 +        {{.Content}}
 +    </article>
 +    <ul>
 +    <!-- Ranges through content/posts/*.md -->
 +    {{ range .Pages }}
 +        <li>
 +            <a href="{{.Permalink}}">{{.Date.Format "2006-01-02"}} | {{.Title}}</a>
 +        </li>
 +    {{ end }}
 +    </ul>
 +</main>
 +{{ end }}
 +{{< /code >}}
 +
 +This above will output the following HTML:
 +
 +{{< code file="example.com/posts/index.html" copy="false" >}}
 +<!--top of your baseof code-->
 +<main>
 +    <article>
 +        <header>
 +            <h1>My Go Journey</h1>
 +        </header>
 +        <p>I decided to start learning Go in March 2017.</p>
 +        <p>Follow my journey through this new blog.</p>
 +    </article>
 +    <ul>
 +        <li><a href="/posts/post-01/">Post 1</a></li>
 +        <li><a href="/posts/post-02/">Post 2</a></li>
 +    </ul>
 +</main>
 +<!--bottom of your baseof-->
 +{{< /code >}}
 +
 +### List Pages Without `_index.md`
 +
 +You do *not* have to create an `_index.md` file for every list page (i.e. section, taxonomy, taxonomy terms, etc) or the homepage. If Hugo does not find an `_index.md` within the respective content section when rendering a list template, the page will be created but with no `{{.Content}}` and only the default values for `.Title` etc.
 +
 +Using this same `layouts/_default/list.html` template and applying it to the `quotes` section above will render the following output. Note that `quotes` does not have an `_index.md` file to pull from:
 +
 +{{< code file="example.com/quote/index.html" copy="false" >}}
 +<!--baseof-->
 +<main>
 +    <article>
 +        <header>
 +        <!-- Hugo assumes that .Title is the name of the section since there is no _index.md content file from which to pull a "title:" field -->
 +            <h1>Quotes</h1>
 +        </header>
 +    </article>
 +    <ul>
 +        <li><a href="https://example.com/quote/quotes-01/">Quote 1</a></li>
 +        <li><a href="https://example.com/quote/quotes-02/">Quote 2</a></li>
 +    </ul>
 +</main>
 +<!--baseof-->
 +{{< /code >}}
 +
 +{{% note %}}
 +The default behavior of Hugo is to pluralize list titles; hence the inflection of the `quote` section to "Quotes" when called with the `.Title` [page variable](/variables/page/). You can change this via the `pluralizeListTitles` directive in your [site configuration](/getting-started/configuration/).
 +{{% /note %}}
 +
 +## Example List Templates
 +
 +### Section Template
 +
 +This list template has been modified slightly from a template originally used in [spf13.com](http://spf13.com/). It makes use of [partial templates][partials] for the chrome of the rendered page rather than using a [base template][base]. The examples that follow also use the [content view templates][views] `li.html` or `summary.html`.
 +
 +{{< code file="layouts/section/posts.html" >}}
 +{{ partial "header.html" . }}
 +{{ partial "subheader.html" . }}
 +<main>
 +  <div>
 +   <h1>{{ .Title }}</h1>
 +        <ul>
 +        <!-- Renders the li.html content view for each content/posts/*.md -->
 +            {{ range .Pages }}
 +                {{ .Render "li"}}
 +            {{ end }}
 +        </ul>
 +  </div>
 +</main>
 +{{ partial "footer.html" . }}
 +{{< /code >}}
 +
 +### Taxonomy Template
 +
 +{{< code file="layouts/_default/taxonomy.html" download="taxonomy.html" >}}
 +{{ define "main" }}
 +<main>
 +  <div>
 +   <h1>{{ .Title }}</h1>
 +   <!-- ranges through each of the content files associated with a particular taxonomy term and renders the summary.html content view -->
 +    {{ range .Pages }}
 +        {{ .Render "summary"}}
 +    {{ end }}
 +  </div>
 +</main>
 +{{ end }}
 +{{< /code >}}
 +
 +## Order Content
 +
 +Hugo lists render the content based on metadata you provide in [front matter][]. In addition to sane defaults, Hugo also ships with multiple methods to make quick work of ordering content inside list templates:
 +
 +### Default: Weight > Date > LinkTitle > FilePath
 +
 +{{< code file="layouts/partials/default-order.html" >}}
 +<ul>
 +    {{ range .Pages }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +### By Weight
 +
 +Lower weight gets higher precedence. So content with lower weight will come first.
 +
 +{{< code file="layouts/partials/by-weight.html" >}}
 +<ul>
 +    {{ range .Pages.ByWeight }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +### By Date
 +
 +{{< code file="layouts/partials/by-date.html" >}}
 +<ul>
 +    <!-- orders content according to the "date" field in front matter -->
 +    {{ range .Pages.ByDate }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +### By Publish Date
 +
 +{{< code file="layouts/partials/by-publish-date.html" >}}
 +<ul>
 +    <!-- orders content according to the "publishdate" field in front matter -->
 +    {{ range .Pages.ByPublishDate }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +### By Expiration Date
 +
 +{{< code file="layouts/partials/by-expiry-date.html" >}}
 +<ul>
 +    {{ range .Pages.ByExpiryDate }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +### By Last Modified Date
 +
 +{{< code file="layouts/partials/by-last-mod.html" >}}
 +<ul>
 +    <!-- orders content according to the "lastmod" field in front matter -->
 +    {{ range .Pages.ByLastmod }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +### By Length
 +
 +{{< code file="layouts/partials/by-length.html" >}}
 +<ul>
 +    <!-- orders content according to content length in ascending order (i.e., the shortest content will be listed first) -->
 +    {{ range .Pages.ByLength }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +### By Title
 +
 +{{< code file="layouts/partials/by-title.html" >}}
 +<ul>
 +    <!-- ranges through content in ascending order according to the "title" field set in front matter -->
 +    {{ range .Pages.ByTitle }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +### By Link Title
 +
 +{{< code file="layouts/partials/by-link-title.html" >}}
 +<ul>
 +    <!-- ranges through content in ascending order according to the "linktitle" field in front matter. If a "linktitle" field is not set, the range will start with content that only has a "title" field and use that value for .LinkTitle -->
 +    {{ range .Pages.ByLinkTitle }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +### By Parameter
 +
 +Order based on the specified front matter parameter. Content that does not have the specified front matter field  will use the site's `.Site.Params` default. If the parameter is not found at all in some entries, those entries will appear together at the end of the ordering.
 +
 +{{< code file="layouts/partials/by-rating.html" >}}
 +<!-- Ranges through content according to the "rating" field set in front matter -->
 +{{ range (.Pages.ByParam "rating") }}
 +  <!-- ... -->
 +{{ end }}
 +{{< /code >}}
 +
 +If the targeted front matter field is nested beneath another field, you can access the field using dot notation.
 +
 +{{< code file="layouts/partials/by-nested-param.html" >}}
 +{{ range (.Pages.ByParam "author.last_name") }}
 +  <!-- ... -->
 +{{ end }}
 +{{< /code >}}
 +
 +### Reverse Order
 +
 +Reversing order can be applied to any of the above methods. The following uses `ByDate` as an example:
 +
 +{{< code file="layouts/partials/by-date-reverse.html" >}}
 +<ul>
 +    {{ range .Pages.ByDate.Reverse }}
 +        <li>
 +            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
 +            <time>{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
 +        </li>
 +    {{ end }}
 +</ul>
 +{{< /code >}}
 +
 +## Group Content
 +
 +Hugo provides some functions for grouping pages by Section, Type, Date, etc.
 +
 +### By Page Field
 +
 +{{< code file="layouts/partials/by-page-field.html" >}}
 +<!-- Groups content according to content section. The ".Key" in this instance will be the section's title. -->
 +{{ range .Pages.GroupBy "Section" }}
 +<h3>{{ .Key }}</h3>
 +<ul>
 +    {{ range .Pages }}
 +    <li>
 +    <a href="{{ .Permalink }}">{{ .Title }}</a>
 +    <div class="meta">{{ .Date.Format "Mon, Jan 2, 2006" }}</div>
 +    </li>
 +    {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +In the above example, you may want `{{.Title}}` to point the `title` field you have added to your `_index.md` file instead. You can access this value using the [`.GetPage` function][getpage]:
 +
 +{{< code file="layouts/partials/by-page-field.html" >}}
 +<!-- Groups content according to content section.-->
 +{{ range .Pages.GroupBy "Section" }}
 +<!-- Checks for existence of _index.md for a section; if available, pulls from "title" in front matter -->
 +{{ with $.Site.GetPage "section" .Key }}
 +<h3>{{.Title}}</h3>
 +{{ else }}
 +<!-- If no _index.md is available, ".Key" defaults to the section title and filters to title casing -->
 +<h3>{{ .Key | title }}</h3>
 +{{ end }}
 +<ul>
 +    {{ range .Pages }}
 +    <li>
 +    <a href="{{ .Permalink }}">{{ .Title }}</a>
 +    <div class="meta">{{ .Date.Format "Mon, Jan 2, 2006" }}</div>
 +    </li>
 +    {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +### By Date
 +
 +{{< code file="layouts/partials/by-page-date.html" >}}
 +<!-- Groups content by month according to the "date" field in front matter -->
 +{{ range .Pages.GroupByDate "2006-01" }}
 +<h3>{{ .Key }}</h3>
 +<ul>
 +    {{ range .Pages }}
 +    <li>
 +    <a href="{{ .Permalink }}">{{ .Title }}</a>
 +    <div class="meta">{{ .Date.Format "Mon, Jan 2, 2006" }}</div>
 +    </li>
 +    {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +### By Publish Date
 +
 +{{< code file="layouts/partials/by-page-publish-date.html" >}}
 +<!-- Groups content by month according to the "publishDate" field in front matter -->
 +{{ range .Pages.GroupByPublishDate "2006-01" }}
 +<h3>{{ .Key }}</h3>
 +<ul>
 +    {{ range .Pages }}
 +    <li>
 +    <a href="{{ .Permalink }}">{{ .Title }}</a>
 +    <div class="meta">{{ .PublishDate.Format "Mon, Jan 2, 2006" }}</div>
 +    </li>
 +    {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +
 +### By Lastmod
 +
 +{{< code file="layouts/partials/by-page-lastmod.html" >}}
 +<!-- Groups content by month according to the "lastMod" field in front matter -->
 +{{ range .Pages.GroupByLastmod "2006-01" }}
 +<h3>{{ .Key }}</h3>
 +<ul>
 +    {{ range .Pages }}
 +    <li>
 +    <a href="{{ .Permalink }}">{{ .Title }}</a>
 +    <div class="meta">{{ .Lastmod.Format "Mon, Jan 2, 2006" }}</div>
 +    </li>
 +    {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +### By Expiry Date
 +
 +{{< code file="layouts/partials/by-page-expiry-date.html" >}}
 +<!-- Groups content by month according to the "expiryDate" field in front matter -->
 +{{ range .Pages.GroupByExpiryDate "2006-01" }}
 +<h3>{{ .Key }}</h3>
 +<ul>
 +    {{ range .Pages }}
 +    <li>
 +    <a href="{{ .Permalink }}">{{ .Title }}</a>
 +    <div class="meta">{{ .ExpiryDate.Format "Mon, Jan 2, 2006" }}</div>
 +    </li>
 +    {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +### By Page Parameter
 +
 +{{< code file="layouts/partials/by-page-param.html" >}}
 +<!-- Groups content according to the "param_key" field in front matter -->
 +{{ range .Pages.GroupByParam "param_key" }}
 +<h3>{{ .Key }}</h3>
 +<ul>
 +    {{ range .Pages }}
 +    <li>
 +    <a href="{{ .Permalink }}">{{ .Title }}</a>
 +    <div class="meta">{{ .Date.Format "Mon, Jan 2, 2006" }}</div>
 +    </li>
 +    {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +### By Page Parameter in Date Format
 +
 +The following template takes grouping by `date` a step further and uses Go's layout string. See the [`Format` function][] for more examples of how to use Go's layout string to format dates in Hugo.
 +
 +{{< code file="layouts/partials/by-page-param-as-date.html" >}}
 +<!-- Groups content by month according to the "param_key" field in front matter -->
 +{{ range .Pages.GroupByParamDate "param_key" "2006-01" }}
 +<h3>{{ .Key }}</h3>
 +<ul>
 +    {{ range .Pages }}
 +    <li>
 +    <a href="{{ .Permalink }}">{{ .Title }}</a>
 +    <div class="meta">{{ .Date.Format "Mon, Jan 2, 2006" }}</div>
 +    </li>
 +    {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +### Reverse Key Order
 +
 +Ordering of groups is performed by keys in alphanumeric order (A–Z, 1–100) and in reverse chronological order (i.e., with the newest first) for dates.
 +
 +While these are logical defaults, they are not always the desired order. There are two different syntaxes to change Hugo's default ordering for groups, both of which work the same way.
 +
 +#### 1. Adding the Reverse Method
 +
 +```
 +{{ range (.Pages.GroupBy "Section").Reverse }}
 +```
 +
 +```
 +{{ range (.Pages.GroupByDate "2006-01").Reverse }}
 +```
 +
 +#### 2. Providing the Alternate Direction
 +
 +```
 +{{ range .Pages.GroupByDate "2006-01" "asc" }}
 +```
 +
 +```
 +{{ range .Pages.GroupBy "Section" "desc" }}
 +```
 +
 +### Order Within Groups
 +
 +Because Grouping returns a `{{.Key}}` and a slice of pages, all of the ordering methods listed above are available.
 +
 +Here is the ordering for the example that follows:
 +
 +1. Content is grouped by month according to the `date` field in front matter.
 +2. Groups are listed in ascending order (i.e., the oldest groups first)
 +3. Pages within each respective group are ordered alphabetically according to the `title`.
 +
 +{{< code file="layouts/partials/by-group-by-page.html" >}}
 +{{ range .Pages.GroupByDate "2006-01" "asc" }}
 +<h3>{{ .Key }}</h3>
 +<ul>
 +    {{ range .Pages.ByTitle }}
 +    <li>
 +    <a href="{{ .Permalink }}">{{ .Title }}</a>
 +    <div class="meta">{{ .Date.Format "Mon, Jan 2, 2006" }}</div>
 +    </li>
 +    {{ end }}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +## Filtering and Limiting Lists {#filtering-and-limiting-lists}
 +
 +Sometimes you only want to list a subset of the available content. A
 +common is to only display posts from [**main sections**][mainsections]
 +on the blog's homepage.
 +
 +See the documentation on [`where` function][wherefunction] and
 +[`first` function][firstfunction] for further details.
 +
 +[base]: /templates/base/
 +[bepsays]: https://bepsays.com/en/2016/12/19/hugo-018/
 +[directorystructure]: /getting-started/directory-structure/
 +[`Format` function]: /functions/format/
 +[front matter]: /content-management/front-matter/
 +[getpage]: /functions/getpage/
 +[homepage]: /templates/homepage/
 +[homepage]: /templates/homepage/
 +[mentalmodel]: https://webstyleguide.com/wsg3/3-information-architecture/3-site-structure.html
 +[pagevars]: /variables/page/
 +[partials]: /templates/partials/
 +[RSS 2.0]: https://cyber.harvard.edu/rss/rss.html "RSS 2.0 Specification"
 +[rss]: /templates/rss/
 +[sections]: /content-management/sections/
 +[sectiontemps]: /templates/section-templates/
 +[sitevars]: /variables/site/
 +[taxlists]: /templates/taxonomy-templates/#taxonomy-list-templates
 +[taxterms]: /templates/taxonomy-templates/#taxonomy-terms-templates
 +[taxvars]: /variables/taxonomy/
 +[views]: /templates/views/
 +[wherefunction]: /functions/where/
 +[firstfunction]: /functions/first/
 +[mainsections]: /functions/where/#mainsections
diff --cc docs/go.mod
index 169f7967f83eaf3f61d4a6ef5b1a7e1865e0d49f,0000000000000000000000000000000000000000..ee6aab404c187888b0a0acc7c872aba11bd34776
mode 100644,000000..100644
--- /dev/null
@@@ -1,5 -1,0 +1,6 @@@
- go 1.12
 +module github.com/gohugoio/hugoDocs
 +
- require github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7 // indirect
++go 1.16
++
++require github.com/gohugoio/gohugoioTheme v0.0.0-20211211134334-0fe25799bb58 // indirect
 +
diff --cc docs/go.sum
index 739466c4aa68e086f58f1ae9c79327331ce45106,0000000000000000000000000000000000000000..2349f8ea68cbffb05242b2c7e56d4c17b0890f7a
mode 100644,000000..100644
--- /dev/null
@@@ -1,31 -1,0 +1,33 @@@
 +github.com/gohugoio/gohugoioTheme v0.0.0-20190808163145-07b3c0f73b02/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20191014144142-1f3a01deed7b h1:PWNjl46fvtz54PKO0BdiXOF6/4L/uCP0F3gtcCxGrJs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20191014144142-1f3a01deed7b/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20191021162625-2e7250ca437d h1:D3DcaYkuJbotdWNNAQpQl37txX4HQ6R5uMHoxVmTw0w=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20191021162625-2e7250ca437d/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200123151337-9475fd449324 h1:UZwHDYtGY0uOKIvcm2LWd+xfFxD3X5L222LIJdI5RE4=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200123151337-9475fd449324/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200123204146-589b4c309025 h1:ScYFARz+bHX1rEr1donVknhRdxGY/cwqK1hHvWEfrlc=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200123204146-589b4c309025/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200123205007-5d6620a0db26 h1:acXfduibbWxji9tW0WkLHbjcXFsnd5uIwXe0WfwOazg=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200123205007-5d6620a0db26/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200128164921-1d0bc5482051 h1:cS14MnUGS6xwWYfPNshimm8HdMCZiYBxWkCD0VnvgVw=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200128164921-1d0bc5482051/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200327225449-368f4cbef8d7 h1:cZ+ahAjSetbFv3aDJ9ipDbKyqaVlmkbSZ5cULgBTh+w=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200327225449-368f4cbef8d7/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200327231942-7f80b3d02bfa h1:kG+O/wT9UXomzp5eQiUuFVZ0l7YylAW6EVPLyjMxi/c=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200327231942-7f80b3d02bfa/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200328100657-2bfd5f8c6aee h1:PJZhCwnuVLyafDWNPSHk9iJvk6gEIvPRnycy7Pq3peA=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200328100657-2bfd5f8c6aee/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200518164958-62cbad03c40f h1:Ge3JACszSUyJW2Az9cJzWdo4PUqdijJA1RxoQSVMBSI=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200518164958-62cbad03c40f/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200518165806-0095b7b902a7 h1:Sy0hlWyZmFtdSY0Cobvw1ZYm3G1aR5+4DuFNRbMkh48=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200518165806-0095b7b902a7/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200711112515-b0dfe471654f h1:BWJyycs4HD7tUbaU8RIGeMay84bIBWRVVLE3yajPas4=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20200711112515-b0dfe471654f/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20210301124928-2c15837dfec3 h1:ShqzOFeeg54FPSuS6q8HSeTVgj2xNZRe/YS0jNbi21g=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20210301124928-2c15837dfec3/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20210409065807-6383d8cbaf65 h1:EJzierSWKqwsrUXU6MaFe0J97c0e5pzl5dBNRRrV2Nc=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20210409065807-6383d8cbaf65/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7 h1:uRCgPslaBgLYy4ANXBoPbBQVM8aNiHoxIZTKUXpkuUA=
 +github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
++github.com/gohugoio/gohugoioTheme v0.0.0-20211211125852-b85e21c1f3d6 h1:lAgdWrn8VEg0PrNCPX4DflCg2msDKpSYV6E8RTNV3N0=
++github.com/gohugoio/gohugoioTheme v0.0.0-20211211125852-b85e21c1f3d6/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs=
index 6d42460521902d9a5a28463c76f26c862a895181,0000000000000000000000000000000000000000..113d85a1f7df6eb7f42d4c0239e834901902b973
mode 100644,000000..100644
--- /dev/null
@@@ -1,41 -1,0 +1,108 @@@
- {{ $file := .Get "file" }}
- {{ $code := "" }}
- {{ with .Get "config" }}
-   {{ $file = $file | default "config" }}
-   {{ $sections := (split . ".") }}
-   {{ $configSection := index $.Site.Data.docs.config $sections }}
-   {{ $code = dict $sections $configSection  }}
-   {{ if $.Get "skipHeader"}}
-     {{ $code = $configSection  }}
-   {{ end }}
- {{ else }}
-   {{ $code = $.Inner }}
- {{ end  }}
- {{ $langs := (slice "yaml" "toml" "json") }}
- <div class="code relative" {{ with $file }}id="{{ . | urlize}}"{{ end }}>
++{{- /*
++Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
++
++@param {string} config
++  Section of site.Data.docs.config to render.
++  Example: markup.highlight
++  Default: ""
++@param {bool} copy
++  Display a copy button.
++  Default: true
++@param {string} file
++  File name to display above the rendered code.
++  Default: ""
++@param {bool} fm
++  Does Inner represent front matter?
++  Default: false
++@param {string} Inner
++  Content between opening and closing shortcode tags.
++  Default: ""
++@param {bool} skipHeader
++  Omit top level key(s) when rendering a section of site.Data.docs.config.
++  Default: false
++@returns {template.HTML}
++*/ -}}
++
++{{- /* Initialize. */ -}}
++{{- $config := "" -}}
++{{- $copy := true -}}
++{{- $file := "" -}}
++{{- $fm := false -}}
++{{- $skipHeader := false -}}
++
++{{- /* Get parameters, defend against string booleans. */ -}}
++{{- if .Params -}}
++  {{- $config = .Get "config" -}}
++  {{- $file = .Get "file" -}}
++  {{- if (isset .Params "copy") -}}
++    {{- if in (slice true "true") (.Get "copy") -}}
++      {{- $copy = true -}}
++    {{- else -}}
++      {{- $copy = false -}}
++    {{- end -}}
++  {{- end -}}
++  {{- if (isset .Params "fm") -}}
++    {{- if in (slice true "true") (.Get "fm") -}}
++      {{- $fm = true -}}
++    {{- else -}}
++      {{- $fm = false -}}
++    {{- end -}}
++  {{- end -}}
++  {{- if (isset .Params "skipHeader") -}}
++    {{- if in (slice true "true") (.Get "skipHeader") -}}
++      {{- $skipHeader = true -}}
++    {{- else -}}
++      {{- $skipHeader = false -}}
++    {{- end -}}
++  {{- end -}}
++{{- end -}}
++
++{{- /* Define constants. */ -}}
++{{- $delimiters := dict "toml" "+++" "yaml" "---" -}}
++{{- $langs := slice "yaml" "toml" "json" -}}
++{{- $placeHolder := "#-hugo-placeholder-#" -}}
++
++{{- /* Render. */ -}}
++{{- $code := "" -}}
++{{- with $config -}}
++  {{- $file = $file | default "config" -}}
++  {{- $sections := (split . ".") -}}
++  {{- $configSection := index $.Site.Data.docs.config $sections -}}
++  {{- $code = dict $sections $configSection -}}
++  {{- if $skipHeader -}}
++    {{- $code = $configSection -}}
++  {{- end -}}
++{{- else -}}
++  {{- $code = $.Inner -}}
++{{- end }}
++<div class="code relative" {{ with $file }}id="{{ . | urlize }}"{{ end }}>
 +  <div class="code-nav flex flex-nowrap items-stretch">
-     {{- with $file -}}
++    {{- with $file }}
 +      <div class="san-serif f6 dib lh-solid pl2 pv2 mr2">
-         {{ . }}.
++        {{- . -}}{{- if not $fm -}}.{{- end -}}
 +      </div>
 +    {{- end -}}
-     {{ range $langs }}
-       <button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" ""}} ba san-serif f6 dib lh-solid ph2 pv2">
++    {{- range $langs }}
++      <button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" "" }} ba san-serif f6 dib lh-solid ph2 pv2">
 +        {{ . }}
 +      </button>
 +      &nbsp;
-     {{ end }}
++    {{- end }}
 +  </div>
 +  <div class="tab-content">
-     {{ range $langs }}
-       <div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" ""}}">
-         {{ highlight ($code | transform.Remarshal . | replaceRE `\n+` "\n" | safeHTML) . "" }}
++    {{- range $langs }}
++      <div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" "" }}">
++        {{- $hCode := $code | transform.Remarshal . -}}
++        {{- if and $fm (in (slice "toml" "yaml") .) -}}
++          {{- $hCode = printf "%s\n%s\n%s" $placeHolder $hCode $placeHolder -}}
++        {{- end -}}
++        {{- $hCode = $hCode | replaceRE `\n+` "\n" }}
++        {{ highlight $hCode . "" | replaceRE $placeHolder (index $delimiters .) | safeHTML }}
 +      </div>
-       {{ if ne ($.Get "copy") "false" }}
++      {{- if $copy }}
 +        <button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"></button>
-         {{/* 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}}
-     {{ end }}
++        {{- /* 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 -}}
++    {{- end }}
 +  </div>
 +</div>
index ad2b7d1e11f1e61adfd363dd98030b2317f9e7f1,0000000000000000000000000000000000000000..ada1d9afc5f1c3320823d7906ec829dd3e95bb84
mode 100644,000000..100644
--- /dev/null
@@@ -1,35 -1,0 +1,35 @@@
- HUGO_VERSION = "0.89.4"
 +[build]
 +publish = "public"
 +command = "hugo --gc --minify"
 +
 +[context.production.environment]
- HUGO_VERSION = "0.89.4"
++HUGO_VERSION = "0.90.1"
 +HUGO_ENV = "production"
 +HUGO_ENABLEGITINFO = "true"
 +
 +[context.split1]
 +command = "hugo --gc --minify --enableGitInfo"
 +
 +[context.split1.environment]
- HUGO_VERSION = "0.89.4"
++HUGO_VERSION = "0.90.1"
 +HUGO_ENV = "production"
 +
 +[context.deploy-preview]
 +command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
 +
 +[context.deploy-preview.environment]
- HUGO_VERSION = "0.89.4"
++HUGO_VERSION = "0.90.1"
 +
 +[context.branch-deploy]
 +command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
 +
 +[context.branch-deploy.environment]
++HUGO_VERSION = "0.90.1"
 +
 +[context.next.environment]
 +HUGO_ENABLEGITINFO = "true"
 +
 +[[redirects]]
 +from = "/npmjs/*"
 +to = "/npmjs/"
 +status = 200