mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Merge commit '327aaed6d8ca57d8e5e3acb99ff53402ff1c556d'
This commit is contained in:
commit
1c7759028e
3 changed files with 7 additions and 22 deletions
|
@ -95,18 +95,15 @@ Website needs to showcase a few of the hundred "testimonials" available as conte
|
||||||
|
|
||||||
To avoid setting the build options on every testimonials, one can use [`cascade`]({{< relref "/content-management/front-matter#front-matter-cascade" >}}) on the testimonial section's content file.
|
To avoid setting the build options on every testimonials, one can use [`cascade`]({{< relref "/content-management/front-matter#front-matter-cascade" >}}) on the testimonial section's content file.
|
||||||
|
|
||||||
```yaml
|
{{< code-toggle >}}
|
||||||
#content/testimonials/_index.md
|
|
||||||
title: Testimonials
|
title: Testimonials
|
||||||
# section build options:
|
|
||||||
_build:
|
_build:
|
||||||
render: true
|
render: true
|
||||||
# children build options with cascade
|
|
||||||
cascade:
|
cascade:
|
||||||
_build:
|
_build:
|
||||||
render: false
|
render: false
|
||||||
list: true # default
|
list: true # default
|
||||||
```
|
{{< /code-toggle >}}
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{/* layouts/_defaults/testimonials.html */}}
|
{{/* layouts/_defaults/testimonials.html */}}
|
||||||
|
|
|
@ -107,19 +107,7 @@ The custom variables need to be prefixed with `$`.
|
||||||
{{ $address := "123 Main St." }}
|
{{ $address := "123 Main St." }}
|
||||||
{{ $address }}
|
{{ $address }}
|
||||||
```
|
```
|
||||||
|
Vriables can be re-defined using the `=` operator. The example below
|
||||||
{{% 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
|
prints "Var is Hugo Home" on the home page, and "Var is Hugo Page" on
|
||||||
all other pages:
|
all other pages:
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
||||||
command = "hugo --gc --minify"
|
command = "hugo --gc --minify"
|
||||||
|
|
||||||
[context.production.environment]
|
[context.production.environment]
|
||||||
HUGO_VERSION = "0.97.3"
|
HUGO_VERSION = "0.98.0"
|
||||||
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.97.3"
|
HUGO_VERSION = "0.98.0"
|
||||||
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.97.3"
|
HUGO_VERSION = "0.98.0"
|
||||||
|
|
||||||
[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.97.3"
|
HUGO_VERSION = "0.98.0"
|
||||||
|
|
||||||
[context.next.environment]
|
[context.next.environment]
|
||||||
HUGO_ENABLEGITINFO = "true"
|
HUGO_ENABLEGITINFO = "true"
|
||||||
|
|
Loading…
Reference in a new issue