Merge commit '45e6fdb315d113ba13e20a633ed0c67e3f25170d'

This commit is contained in:
Bjørn Erik Pedersen 2021-12-13 21:05:10 +01:00
commit 6183184b96
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
162 changed files with 274 additions and 103 deletions

2
docs/.gitignore vendored
View file

@ -1,7 +1,9 @@
/.idea
/.vscode
/public
node_modules
nohup.out
.DS_Store
trace.out
.hugo_build.lock
resources/_gen/images/

4
docs/.markdownlint.yaml Normal file
View file

@ -0,0 +1,4 @@
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
MD013: false # Line length
MD033: false # Inline HTML

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

View file

@ -47,9 +47,9 @@
{{ end }}
{{ partial "site-manifest.html" . }}
{{- partial "head-additions.html" . -}}
{{- template "_internal/opengraph.html" . -}}
{{- partial "opengraph/opengraph.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
{{- partial "opengraph/twitter_cards.html" . -}}
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{ partial "gtag" . }}

View file

@ -1,6 +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>

View file

@ -1,6 +1,6 @@
{{ $currentPage := . }}
{{ $menu := .Site.Menus.docs.ByWeight }}
<ul class="list dib ph0 ma0 scrolling-touch tc">
<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}}">

View file

@ -1,6 +1,6 @@
{{ $currentPage := . }}
{{ $menu := .Site.Menus.global }}
<ul class="list hidden dib ph0 ma0 scrolling-touch tc">
<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}}">

View file

@ -1,12 +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>

View file

@ -0,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 }}

View file

@ -0,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 }}

View file

@ -0,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 -}}

View file

@ -41,7 +41,7 @@
<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 w-100">
<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>

View file

@ -3,4 +3,4 @@
<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>
</form>

View file

@ -28,7 +28,7 @@
"highlight.js": "^9.13.1",
"lazysizes": "^5.2.1",
"mini-css-extract-plugin": "^0.4.4",
"postcss": "^7.0.32",
"postcss": "^7.0.36",
"postcss-cssnext": "^3.1.0",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",

View file

@ -1 +1 @@
# github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7
# github.com/gohugoio/gohugoioTheme v0.0.0-20211211134334-0fe25799bb58

View file

@ -42,8 +42,8 @@ maxAge = -1
dir = ":cacheDir/:project"
maxAge = -1
[caches.images]
dir = ":resourceDir/_gen"
maxAge = -1
dir = ":cacheDir/images"
maxAge = "1440h"
[caches.assets]
dir = ":resourceDir/_gen"
maxAge = -1

View file

@ -1,6 +1,6 @@
---
title: Multilingual Mode
linktitle: Multilingual and i18n
linktitle: Multilingual
description: Hugo supports the creation of websites with multiple languages side by side.
date: 2017-01-10
publishdate: 2017-01-10

View file

@ -402,13 +402,7 @@ Last but not least you should accept the contributor license agreement (CLA). A
### Automatic builds
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.
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?

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View file

@ -1,5 +1,5 @@
---
title: Image Functions
title: Image Filters
description: The images namespace provides a list of filters and other image related functions.
date: 2017-02-01
categories: [functions]
@ -11,12 +11,9 @@ keywords: [images]
toc: true
---
## Image Filters
See [images.Filter](#filter) for how to apply these filters to an image.
### Overlay
## Overlay
{{< new-in "0.80.0" >}}
@ -40,7 +37,7 @@ A shorter version of the above, if you only need to apply the filter once:
The above will overlay `$logo` in the upper left corner of `$img` (at position `x=50, y=50`).
### Text
## Text
{{< new-in "0.90.0" >}}
@ -75,7 +72,7 @@ You can load a custom font if needed. Load the font as a Hugo `Resource` and set
```
### Brightness
## Brightness
{{% funcsig %}}
images.Brightness PERCENTAGE
@ -93,7 +90,7 @@ images.ColorBalance PERCENTAGERED PERCENTAGEGREEN PERCENTAGEBLUE
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).
### Colorize
## Colorize
{{% funcsig %}}
images.Colorize HUE SATURATION PERCENTAGE
@ -104,7 +101,7 @@ 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).
### Contrast
## Contrast
{{% funcsig %}}
images.Contrast PERCENTAGE
@ -113,7 +110,7 @@ images.Contrast PERCENTAGE
Contrast creates a filter that changes the contrast of an image.
The percentage parameter must be in range (-100, 100).
### Gamma
## Gamma
{{% funcsig %}}
images.Gamma GAMMA
@ -123,7 +120,7 @@ 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.
### GaussianBlur
## GaussianBlur
{{% funcsig %}}
images.GaussianBlur SIGMA
@ -139,7 +136,7 @@ images.Grayscale
Grayscale creates a filter that produces a grayscale version of an image.
### Hue
## Hue
{{% funcsig %}}
images.Hue SHIFT
@ -148,7 +145,7 @@ images.Hue SHIFT
Hue creates a filter that rotates the hue of an image.
The hue angle shift is typically in range -180 to 180.
### Invert
## Invert
{{% funcsig %}}
images.Invert
@ -156,7 +153,7 @@ images.Invert
Invert creates a filter that negates the colors of an image.
### Pixelate
## Pixelate
{{% funcsig %}}
images.Pixelate SIZE
@ -164,7 +161,7 @@ images.Pixelate SIZE
Pixelate creates a filter that applies a pixelation effect to an image.
### Saturation
## Saturation
{{% funcsig %}}
images.Saturation PERCENTAGE
@ -172,7 +169,7 @@ images.Saturation PERCENTAGE
Saturation creates a filter that changes the saturation of an image.
### Sepia
## Sepia
{{% funcsig %}}
images.Sepia PERCENTAGE
@ -180,7 +177,7 @@ images.Sepia PERCENTAGE
Sepia creates a filter that produces a sepia-toned version of an image.
### Sigmoid
## Sigmoid
{{% funcsig %}}
images.Sigmoid MIDPOINT FACTOR
@ -189,7 +186,7 @@ images.Sigmoid MIDPOINT FACTOR
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
## UnsharpMask
{{% funcsig %}}
images.UnsharpMask SIGMA AMOUNT THRESHOLD

View file

@ -1,5 +1,6 @@
---
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
@ -13,39 +14,56 @@ menu:
weight: 01
sections_weight: 01
draft: false
toc: true
aliases: [/assets/]
---
### Asset directory
## Get Resource with resources.Get
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.
### 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 the filepath of the file relative to the asset directory or the URL of the file.
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
{{ $style := resources.Get "sass/main.scss" }}
{{ $remoteStyle := resources.Get "https://www.example.com/styles.scss" }}
{{ $local := resources.Get "sass/main.scss" }}
{{ $remote := resources.Get "https://www.example.com/styles.scss" }}
```
#### Request options
`resources.Get` will always return `nil` if the resource could not be found.
When using an URL, the `resources.Get` function takes an optional options map as the last argument, e.g.:
### 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
{{ 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 }}
```
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:
```
```go-html-template
{{ $postResponse := resources.Get "https://example.org/api" (dict
"method" "post"
"body" `{"complete": true}`
@ -55,40 +73,41 @@ You can also change the request method and set the request body:
)}}
```
#### Cache of remote resources
### Caching of Remote Resources
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.
Remote resources fetched with `resources.Get` will be cached on disk. See [Configure File Caches](/getting-started/configuration/#configure-file-caches) for details.
With the command-line flag `--cacheDir`, you can specify any folder on your system as a caching directory.
## Asset directory
You can also set `cacheDir` or `caches.getresource` in the [main configuration file][config].
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.
If you don't like caching at all, you can fully disable caching with the command line flag `--ignoreCache`.
### Asset publishing
### Asset Publishing
Assets will only be published (to `/public`) if `.Permalink` or `.RelPermalink` is used.
Assets will only be published (to `/public`) if `.Permalink` or `.RelPermalink` is used. You can use `.Content` to inline the asset.
### Go Pipes
## 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 }}">
```
### Method aliases
## 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
## Caching
Hugo Pipes invocations are cached based on the entire _pipe chain_.

View file

@ -1,6 +1,6 @@
---
title: Introduction to Hugo Templating
linktitle: Introduction
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

View file

@ -1,6 +1,6 @@
---
title: Lists of Content in Hugo
linktitle: List Page Templates
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

View file

@ -1,5 +1,6 @@
module github.com/gohugoio/hugoDocs
go 1.12
go 1.16
require github.com/gohugoio/gohugoioTheme v0.0.0-20211211134334-0fe25799bb58 // indirect
require github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7 // indirect

View file

@ -29,3 +29,5 @@ github.com/gohugoio/gohugoioTheme v0.0.0-20210409065807-6383d8cbaf65 h1:EJzierSW
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=

View file

@ -1,41 +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>

View file

@ -3,7 +3,7 @@ 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"
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
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.89.4"
HUGO_VERSION = "0.90.1"
[context.next.environment]
HUGO_ENABLEGITINFO = "true"

Some files were not shown because too many files have changed in this diff Show more