header.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {{- partial "load-photoswipe-theme.html" . }}
  2. {{ if .IsHome }}
  3. {{ if .Site.Params.homeTitle }}{{ $.Scratch.Set "title" .Site.Params.homeTitle }}{{ else }}{{ $.Scratch.Set "title" .Site.Title }}{{ end }}
  4. {{ if .Site.Params.subtitle }}{{ $.Scratch.Set "subtitle" .Site.Params.subtitle }}{{ end }}
  5. {{ if .Site.Params.bigimg }}{{ $.Scratch.Set "bigimg" .Site.Params.bigimg }}{{ end }}
  6. {{ else }}
  7. {{ $.Scratch.Set "title" .Title }}
  8. {{ if .Params.subtitle }}{{ $.Scratch.Set "subtitle" .Params.subtitle }}{{ end }}
  9. {{ if .Params.bigimg }}{{ $.Scratch.Set "bigimg" .Params.bigimg }}{{ end }}
  10. {{ end }}
  11. {{ $bigimg := $.Scratch.Get "bigimg" }}
  12. {{ $title := $.Scratch.Get "title" }}
  13. {{ $subtitle := $.Scratch.Get "subtitle" }}
  14. {{ if or $bigimg $title }}
  15. {{ if $bigimg }}
  16. <div id="header-big-imgs" data-num-img={{len $bigimg}}
  17. {{range $i, $img := $bigimg}}
  18. {{ if (fileExists $img.src)}}
  19. data-img-src-{{add $i 1}}="{{$img.src | absURL }}"
  20. {{else}}
  21. data-img-src-{{add $i 1}}="{{$img.src}}"
  22. {{end}}
  23. {{ if $img.desc}}data-img-desc-{{add $i 1}}="{{$img.desc}}"{{end}}
  24. {{end}}></div>
  25. {{ end }}
  26. <header class="header-section {{ if $bigimg }}has-img{{ end }}">
  27. {{ if $bigimg }}
  28. {{ $firstimg := index $bigimg 0 }}
  29. <div class="intro-header big-img" style="background-image: url('{{$firstimg.src}}');">
  30. {{ $subtitle := $.Scratch.Get "subtitle" }}
  31. <div class="container">
  32. <div class="row">
  33. <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
  34. <div class="{{ .Type }}-heading">
  35. <h1>{{ with $.Scratch.Get "title" }}{{.}}{{ else }}<br/>{{ end }}</h1>
  36. {{ if $subtitle }}
  37. {{ if eq .Type "page" }}
  38. <hr class="small">
  39. <span class="{{ .Type }}-subheading">{{ $subtitle }}</span>
  40. {{ else }}
  41. <h2 class="{{ .Type }}-subheading">{{ $subtitle }}</h2>
  42. {{ end }}
  43. {{ end }}
  44. {{ if eq .Type "post" }}
  45. {{ partial "post_meta.html" . }}
  46. {{ end }}
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <span class="img-desc" style="display: {{ cond (isset $firstimg "desc") "inline" "none"}};">{{$firstimg.desc}}</span>
  52. </div>
  53. {{end}}
  54. {{ if $title }}
  55. <div class="intro-header no-img">
  56. <div class="container">
  57. <div class="row">
  58. <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
  59. <div class="{{ .Type }}-heading">
  60. {{ if eq .Type "list" }}
  61. <h1>{{ if .Data.Singular }}#{{ end }}{{ .Title }}</h1>
  62. {{ else }}
  63. <h1>{{ with $title }}{{.}}{{ else }}<br/>{{ end }}</h1>
  64. {{ end }}
  65. {{ if ne .Type "post" }}
  66. <hr class="small">
  67. {{ end }}
  68. {{ if $subtitle }}
  69. {{ if eq .Type "page" }}
  70. <span class="{{ .Type }}-subheading">{{ $subtitle }}</span>
  71. {{ else }}
  72. <h2 class="{{ .Type }}-subheading">{{ $subtitle }}</h2>
  73. {{ end }}
  74. {{ end }}
  75. {{ if eq .Type "post" }}
  76. {{ partial "post_meta.html" . }}
  77. {{ end }}
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. {{ end }}
  84. </header>
  85. {{ else }}
  86. <div class="intro-header"></div>
  87. {{ end }}