nemhugo/layouts/partials/header.html
Michael Romero 4d866ddfd7 Default date format if not defined in config.toml
Default date format if not defined in config.toml
2017-03-25 20:10:24 -07:00

70 lines
No EOL
3 KiB
HTML

{{ if .IsHome }}
{{ $.Scratch.Add "title" .Site.Title }}
{{ 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 "title" .Title }}
{{ if .Params.subtitle }}{{ $.Scratch.Add "subtitle" .Params.subtitle }}{{ end }}
{{ if .Params.bigimg }}{{ $.Scratch.Add "bigimg" .Params.bigimg }}{{ end }}
{{ 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">
{{ $subtitle := $.Scratch.Get "subtitle" }}
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="{{ .Type }}-heading">
<h1>{{ with $.Scratch.Get "title" }}{{.}}{{ else }}<br/>{{ end }}</h1>
{{ if $subtitle }}
{{ if eq .Type "page" }}
<hr class="small">
<span class="{{ .Type }}-subheading">{{ $subtitle }}</span>
{{ else }}
<h2 class="{{ .Type }}-subheading">{{ $subtitle }}</h2>
{{ end }}
{{ end }}
{{ if eq .Type "post" }}
<span class="post-meta">Posted on {{ .Date.Format (default "January 2, 2006" .Site.Params.dateFormat) }}</span>
{{ end }}
</div>
</div>
</div>
</div>
<span class="img-desc" style="display: inline;"></span>
</div>
{{end}}
<div class="intro-header no-img">
{{ $subtitle := $.Scratch.Get "subtitle" }}
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="{{ .Type }}-heading">
<h1>{{ with $.Scratch.Get "title" }}{{.}}{{ else }}<br/>{{ end }}</h1>
{{ if $subtitle }}
{{ if eq .Type "page" }}
<hr class="small">
<span class="{{ .Type }}-subheading">{{ $subtitle }}</span>
{{ else }}
<h2 class="{{ .Type }}-subheading">{{ $subtitle }}</h2>
{{ end }}
{{ end }}
{{ if eq .Type "post" }}
<span class="post-meta">Posted on {{ .Date.Format (default "January 2, 2006" .Site.Params.dateFormat) }}</span>
{{ end }}
</div>
</div>
</div>
</div>
</div>
</header>
{{ else }}
<div class="intro-header"></div>
{{ end }}