mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit '45e6fdb315d113ba13e20a633ed0c67e3f25170d'
This commit is contained in:
@@ -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
|
||||
|
@@ -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 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.
|
||||
|
||||

|
||||
|
||||
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?
|
||||
|
||||
|
BIN
docs/content/en/featured.png
Normal file
BIN
docs/content/en/featured.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
@@ -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
|
||||
|
@@ -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_.
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user