Handle optional variables in header
Handle optional variables such as "subtitle" and "bigimg" in header to avoid errors when these variables are not set.
This commit is contained in:
parent
ee6246379b
commit
3e2b5c77dd
1 changed files with 4 additions and 4 deletions
|
|
@ -1,11 +1,11 @@
|
|||
{{ if .IsHome }}
|
||||
{{ $.Scratch.Add "bigimg" .Site.Params.bigimg }}
|
||||
{{ $.Scratch.Add "title" .Site.Title }}
|
||||
{{ $.Scratch.Add "subtitle" .Site.Params.subtitle }}
|
||||
{{ if .Site.Params.subtitle }}{{ $.Scratch.Add "subtitle" .Site.Params.subtitle }}{{ end }}
|
||||
{{ if .Site.Params.bigimg }}{{ $.Scratch.Add "bigimg" .Site.Params.bigimg }}{{ end }}
|
||||
{{ else }}
|
||||
{{ $.Scratch.Add "bigimg" .Params.bigimg }}
|
||||
{{ $.Scratch.Add "title" .Title }}
|
||||
{{ $.Scratch.Add "subtitle" .Params.subtitle }}
|
||||
{{ if .Params.subtitle }}{{ $.Scratch.Add "subtitle" .Params.subtitle }}{{ end }}
|
||||
{{ if .Params.bigimg }}{{ $.Scratch.Add "bigimg" .Params.bigimg }}{{ end }}
|
||||
{{ end }}
|
||||
{{ $bigimg := $.Scratch.Get "bigimg" }}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue