nemhugo/layouts/partials/header_wp.html
Li-Wen Yip 730ce3d9d3 User header_wp.html partial in index.html
- Changed header_wp.html and header.html so that they will also work on
the homepage (if the current page is the homepage then use the site
bigimg/title/subtitle, otherwise use the page bigimg/title/subtitle;
need to add them to the scratchpad so that they are accessible outside
the scope of the if/else statement).
- Change index.html to use the header_wp.html partial instead of
duplicating the same code
2017-03-11 20:49:44 +00:00

30 lines
No EOL
1 KiB
HTML

{{ if .IsHome }}
{{ $.Scratch.Add "bigimg" .Site.Params.bigimg }}
{{ $.Scratch.Add "title" .Site.Title }}
{{ $.Scratch.Add "subtitle" .Site.Params.subtitle }}
{{ else }}
{{ $.Scratch.Add "bigimg" .Params.bigimg }}
{{ $.Scratch.Add "title" .Title }}
{{ $.Scratch.Add "subtitle" .Params.subtitle }}
{{ end }}
{{ $bigimg := $.Scratch.Get "bigimg" }}
{{ if or $bigimg ($.Scratch.Get "title") }}
{{ if isset $bigimg 0 }}
<div id="header-big-imgs" data-num-img={{len $bigimg}} {{range $i, $img := $bigimg}}data-img-src-{{add $i 1}}="{{$img.src}}" {{ if $img.desc}}data-img-desc-{{add $i 1}}="{{$img.desc}}"{{end}}{{end}}></div>
{{ end }}
<header class="header-section {{ if isset $bigimg 0 }}has-img{{ end }}">
{{ if isset $bigimg 0 }}
<div class="intro-header big-img">
{{ partial "header.html" . }}
<span class="img-desc" style="display: inline;"></span>
</div>
{{end}}
<div class="intro-header no-img">
{{ partial "header.html" . }}
</div>
</header>
{{ else }}
<div class="intro-header"></div>
{{ end }}