mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-18 10:00:25 -04:00
Replace erroneous use of nocopy shortcode param
This commit is contained in:
parent
064896c06e
commit
ac333c7954
@ -51,7 +51,7 @@ Both of the above `default` function calls return `Roboto`.
|
|||||||
|
|
||||||
A `default` value, however, does not need to be hard coded like the previous example. The `default` value can be a variable or pulled directly from the front matter using dot notation:
|
A `default` value, however, does not need to be hard coded like the previous example. The `default` value can be a variable or pulled directly from the front matter using dot notation:
|
||||||
|
|
||||||
{{< code file="variable-as-default-value.html" nocopy="true" >}}
|
{{< code file="variable-as-default-value.html" copy="false" >}}
|
||||||
{{$old := .Params.oldparam }}
|
{{$old := .Params.oldparam }}
|
||||||
<p>{{ .Params.newparam | default $old }}</p>
|
<p>{{ .Params.newparam | default $old }}</p>
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
@ -78,14 +78,14 @@ The following have equivalent return values but are far less terse. This demonst
|
|||||||
|
|
||||||
Using `if`:
|
Using `if`:
|
||||||
|
|
||||||
{{< code file="if-instead-of-default.html" nocopy="true" >}}
|
{{< code file="if-instead-of-default.html" copy="false" >}}
|
||||||
<title>{{if .Params.seo_title}}{{.Params.seo_title}}{{else}}{{.Title}}{{end}}</title>
|
<title>{{if .Params.seo_title}}{{.Params.seo_title}}{{else}}{{.Title}}{{end}}</title>
|
||||||
=> Sane Defaults
|
=> Sane Defaults
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
|
|
||||||
Using `with`:
|
Using `with`:
|
||||||
|
|
||||||
{{< code file="with-instead-of-default.html" nocopy="true" >}}
|
{{< code file="with-instead-of-default.html" copy="false" >}}
|
||||||
<title>{{with .Params.seo_title}}{{.}}{{else}}{{.Title}}{{end}}</title>
|
<title>{{with .Params.seo_title}}{{.}}{{else}}{{.Title}}{{end}}</title>
|
||||||
=> Sane Defaults
|
=> Sane Defaults
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user