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 /.idea
/.vscode
/public /public
node_modules node_modules
nohup.out nohup.out
.DS_Store .DS_Store
trace.out trace.out
.hugo_build.lock .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 }} {{ end }}
{{ partial "site-manifest.html" . }} {{ partial "site-manifest.html" . }}
{{- partial "head-additions.html" . -}} {{- partial "head-additions.html" . -}}
{{- template "_internal/opengraph.html" . -}} {{- partial "opengraph/opengraph.html" . -}}
{{- template "_internal/schema.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") }} {{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{ partial "gtag" . }} {{ partial "gtag" . }}

View file

@ -1,6 +1,3 @@
<h6 class="f4 dark-gray mb2"> <h6 class="f6 dark-gray mb2">
<a href="{{ .Permalink }}" class="hide-child link primary-color"> 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 }}
<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> </h6>

View file

@ -1,6 +1,6 @@
{{ $currentPage := . }} {{ $currentPage := . }}
{{ $menu := .Site.Menus.docs.ByWeight }} {{ $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 }} {{ 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 }}"> <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}}"> <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 := . }} {{ $currentPage := . }}
{{ $menu := .Site.Menus.global }} {{ $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 }} {{ range $menu }}
<li class="tl dib ma0 hover-bg-black w-100"> <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}}"> <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" . }} {{ partial "nav-links-global-mobile.html" . }}
</div> </div>
<div class="docsmenu mobilemenu pb3 dn"> <div class="docsmenu mobilemenu pb1 dn">
{{ partial "nav-links-docs-mobile.html" . }} {{ partial "nav-links-docs-mobile.html" . }}
</div> </div>
<div class="flex dn-l justify-between"> <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> </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"/> <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" . -}} {{- partial "nav-mobile.html" . -}}
</div> </div>

View file

@ -28,7 +28,7 @@
"highlight.js": "^9.13.1", "highlight.js": "^9.13.1",
"lazysizes": "^5.2.1", "lazysizes": "^5.2.1",
"mini-css-extract-plugin": "^0.4.4", "mini-css-extract-plugin": "^0.4.4",
"postcss": "^7.0.32", "postcss": "^7.0.36",
"postcss-cssnext": "^3.1.0", "postcss-cssnext": "^3.1.0",
"postcss-import": "^12.0.1", "postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0", "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" dir = ":cacheDir/:project"
maxAge = -1 maxAge = -1
[caches.images] [caches.images]
dir = ":resourceDir/_gen" dir = ":cacheDir/images"
maxAge = -1 maxAge = "1440h"
[caches.assets] [caches.assets]
dir = ":resourceDir/_gen" dir = ":resourceDir/_gen"
maxAge = -1 maxAge = -1

View file

@ -1,6 +1,6 @@
--- ---
title: Multilingual Mode title: Multilingual Mode
linktitle: Multilingual and i18n linktitle: Multilingual
description: Hugo supports the creation of websites with multiple languages side by side. description: Hugo supports the creation of websites with multiple languages side by side.
date: 2017-01-10 date: 2017-01-10
publishdate: 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 ### 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. 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.
![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.
## Where to start? ## 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. description: The images namespace provides a list of filters and other image related functions.
date: 2017-02-01 date: 2017-02-01
categories: [functions] categories: [functions]
@ -11,12 +11,9 @@ keywords: [images]
toc: true toc: true
--- ---
## Image Filters
See [images.Filter](#filter) for how to apply these filters to an image. See [images.Filter](#filter) for how to apply these filters to an image.
### Overlay ## Overlay
{{< new-in "0.80.0" >}} {{< 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`). 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" >}} {{< 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 %}} {{% funcsig %}}
images.Brightness PERCENTAGE images.Brightness PERCENTAGE
@ -93,7 +90,7 @@ images.ColorBalance PERCENTAGERED PERCENTAGEGREEN PERCENTAGEBLUE
ColorBalance creates a filter that changes the color balance of an image. 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). The percentage parameters for each color channel (red, green, blue) must be in range (-100, 500).
### Colorize ## Colorize
{{% funcsig %}} {{% funcsig %}}
images.Colorize HUE SATURATION PERCENTAGE 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 saturation parameter must be in range (0, 100).
The percentage parameter specifies the strength of the effect, it 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 %}} {{% funcsig %}}
images.Contrast PERCENTAGE images.Contrast PERCENTAGE
@ -113,7 +110,7 @@ images.Contrast PERCENTAGE
Contrast creates a filter that changes the contrast of an image. Contrast creates a filter that changes the contrast of an image.
The percentage parameter must be in range (-100, 100). The percentage parameter must be in range (-100, 100).
### Gamma ## Gamma
{{% funcsig %}} {{% funcsig %}}
images.Gamma GAMMA 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. 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. Gamma less than 1 darkens the image and gamma greater than 1 lightens it.
### GaussianBlur ## GaussianBlur
{{% funcsig %}} {{% funcsig %}}
images.GaussianBlur SIGMA images.GaussianBlur SIGMA
@ -139,7 +136,7 @@ images.Grayscale
Grayscale creates a filter that produces a grayscale version of an image. Grayscale creates a filter that produces a grayscale version of an image.
### Hue ## Hue
{{% funcsig %}} {{% funcsig %}}
images.Hue SHIFT images.Hue SHIFT
@ -148,7 +145,7 @@ images.Hue SHIFT
Hue creates a filter that rotates the hue of an image. Hue creates a filter that rotates the hue of an image.
The hue angle shift is typically in range -180 to 180. The hue angle shift is typically in range -180 to 180.
### Invert ## Invert
{{% funcsig %}} {{% funcsig %}}
images.Invert images.Invert
@ -156,7 +153,7 @@ images.Invert
Invert creates a filter that negates the colors of an image. Invert creates a filter that negates the colors of an image.
### Pixelate ## Pixelate
{{% funcsig %}} {{% funcsig %}}
images.Pixelate SIZE images.Pixelate SIZE
@ -164,7 +161,7 @@ images.Pixelate SIZE
Pixelate creates a filter that applies a pixelation effect to an image. Pixelate creates a filter that applies a pixelation effect to an image.
### Saturation ## Saturation
{{% funcsig %}} {{% funcsig %}}
images.Saturation PERCENTAGE images.Saturation PERCENTAGE
@ -172,7 +169,7 @@ images.Saturation PERCENTAGE
Saturation creates a filter that changes the saturation of an image. Saturation creates a filter that changes the saturation of an image.
### Sepia ## Sepia
{{% funcsig %}} {{% funcsig %}}
images.Sepia PERCENTAGE images.Sepia PERCENTAGE
@ -180,7 +177,7 @@ images.Sepia PERCENTAGE
Sepia creates a filter that produces a sepia-toned version of an image. Sepia creates a filter that produces a sepia-toned version of an image.
### Sigmoid ## Sigmoid
{{% funcsig %}} {{% funcsig %}}
images.Sigmoid MIDPOINT FACTOR 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. 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. It's a non-linear contrast change useful for photo adjustments as it preserves highlight and shadow detail.
### UnsharpMask ## UnsharpMask
{{% funcsig %}} {{% funcsig %}}
images.UnsharpMask SIGMA AMOUNT THRESHOLD images.UnsharpMask SIGMA AMOUNT THRESHOLD

View file

@ -1,5 +1,6 @@
--- ---
title: Hugo Pipes Introduction title: Hugo Pipes Introduction
linkTitle: Hugo Pipes
description: Hugo Pipes is Hugo's asset processing set of functions. description: Hugo Pipes is Hugo's asset processing set of functions.
date: 2018-07-14 date: 2018-07-14
publishdate: 2018-07-14 publishdate: 2018-07-14
@ -13,39 +14,56 @@ menu:
weight: 01 weight: 01
sections_weight: 01 sections_weight: 01
draft: false draft: false
toc: true
aliases: [/assets/] 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. 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.
### 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.
```go-html-template ```go-html-template
{{ $style := resources.Get "sass/main.scss" }} {{ $local := resources.Get "sass/main.scss" }}
{{ $remoteStyle := resources.Get "https://www.example.com/styles.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")) }} {{ $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: 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"))) }} {{ $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: You can also change the request method and set the request body:
``` ```go-html-template
{{ $postResponse := resources.Get "https://example.org/api" (dict {{ $postResponse := resources.Get "https://example.org/api" (dict
"method" "post" "method" "post"
"body" `{"complete": true}` "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): For improved readability, the Hugo Pipes examples of this documentation will be written using [Go Pipes](/templates/introduction/#pipes):
```go-html-template ```go-html-template
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} {{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}"> <link rel="stylesheet" href="{{ $style.Permalink }}">
``` ```
### Method aliases ## Method aliases
Each Hugo Pipes `resources` transformation method uses a __camelCased__ alias (`toCSS` for `resources.ToCSS`). 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`. 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: The example above can therefore also be written as follows:
```go-html-template ```go-html-template
{{ $style := resources.Get "sass/main.scss" | toCSS | minify | fingerprint }} {{ $style := resources.Get "sass/main.scss" | toCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}"> <link rel="stylesheet" href="{{ $style.Permalink }}">
``` ```
### Caching ## Caching
Hugo Pipes invocations are cached based on the entire _pipe chain_. Hugo Pipes invocations are cached based on the entire _pipe chain_.

View file

@ -1,6 +1,6 @@
--- ---
title: Introduction to Hugo Templating 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. description: Hugo uses Go's `html/template` and `text/template` libraries as the basis for the templating.
date: 2017-02-01 date: 2017-02-01
publishdate: 2017-02-01 publishdate: 2017-02-01

View file

@ -1,6 +1,6 @@
--- ---
title: Lists of Content in Hugo 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. 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 date: 2017-02-01
publishdate: 2017-02-01 publishdate: 2017-02-01

View file

@ -1,5 +1,6 @@
module github.com/gohugoio/hugoDocs 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-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 h1:uRCgPslaBgLYy4ANXBoPbBQVM8aNiHoxIZTKUXpkuUA=
github.com/gohugoio/gohugoioTheme v0.0.0-20210409071416-c88da48134b7/go.mod h1:kpw3SS48xZvLQGEXKu8u5XHgXkPvL8DX3oGa07+z8Bs= 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 := "" }} Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
{{ with .Get "config" }}
{{ $file = $file | default "config" }} @param {string} config
{{ $sections := (split . ".") }} Section of site.Data.docs.config to render.
{{ $configSection := index $.Site.Data.docs.config $sections }} Example: markup.highlight
{{ $code = dict $sections $configSection }} Default: ""
{{ if $.Get "skipHeader"}} @param {bool} copy
{{ $code = $configSection }} Display a copy button.
{{ end }} Default: true
{{ else }} @param {string} file
{{ $code = $.Inner }} File name to display above the rendered code.
{{ end }} Default: ""
{{ $langs := (slice "yaml" "toml" "json") }} @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 relative" {{ with $file }}id="{{ . | urlize }}"{{ end }}>
<div class="code-nav flex flex-nowrap items-stretch"> <div class="code-nav flex flex-nowrap items-stretch">
{{- with $file -}} {{- with $file }}
<div class="san-serif f6 dib lh-solid pl2 pv2 mr2"> <div class="san-serif f6 dib lh-solid pl2 pv2 mr2">
{{ . }}. {{- . -}}{{- if not $fm -}}.{{- end -}}
</div> </div>
{{- end -}} {{- end -}}
{{ range $langs }} {{- range $langs }}
<button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" "" }} ba san-serif f6 dib lh-solid ph2 pv2"> <button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" "" }} ba san-serif f6 dib lh-solid ph2 pv2">
{{ . }} {{ . }}
</button> </button>
&nbsp; &nbsp;
{{ end }} {{- end }}
</div> </div>
<div class="tab-content"> <div class="tab-content">
{{ range $langs }} {{- range $langs }}
<div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" "" }}"> <div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" "" }}">
{{ highlight ($code | transform.Remarshal . | replaceRE `\n+` "\n" | safeHTML) . "" }} {{- $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> </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> <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 */}} {{- /* 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 -}}
{{ end }} {{- end }}
</div> </div>
</div> </div>

View file

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

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