Consolidate header_wp.html and header.html

Consolidate header_wp.html and header.html to a single header.html
file.
This commit is contained in:
halogenica 2017-03-19 16:50:32 -07:00
parent b44b51c9f1
commit ee6246379b
5 changed files with 69 additions and 51 deletions

View File

@ -6,7 +6,7 @@
<body>
{{ partial "nav.html" . }}
{{ partial "header_wp.html" . }}
{{ partial "header.html" . }}
<div class="container" role="main">
{{ if eq .Type "post" }}

View File

@ -6,7 +6,7 @@
<body>
{{ partial "nav.html" . }}
{{ partial "header_wp.html" . }}
{{ partial "header.html" . }}
<div class="container" role="main">
<article class="post-preview">

View File

@ -6,7 +6,7 @@
<body>
{{ partial "nav.html" . }}
{{ partial "header_wp.html" . }}
{{ partial "header.html" . }}
<div role="main" class="container">
<div class="row">

View File

@ -1,22 +1,70 @@
{{ $subtitle := $.Scratch.Get "subtitle" }}
{{ 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" }}
<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 .Site.Params.dateFormat }}</span>
{{ end }}
{{ 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 .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 .Site.Params.dateFormat }}</span>
{{ end }}
</div>
</div>
</div>
</div>
</div>
</div>
</header>
{{ else }}
<div class="intro-header"></div>
{{ end }}

View File

@ -1,30 +0,0 @@
{{ 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 }}