slider.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {{ $ := .root }}
  2. {{ $page := .page }}
  3. {{ $hash_id := .hash_id }}
  4. <!-- Indicators -->
  5. <ol class="carousel-indicators">
  6. {{ range $index, $item := $page.Params.item }}
  7. <li data-target="#{{$hash_id}}" data-slide-to="{{$index}}" {{if eq $index 0}}class="active"{{end}}></li>
  8. {{ end }}
  9. </ol>
  10. <!-- Carousel slides wrapper -->
  11. <div class="carousel-inner">
  12. {{ range $index, $item := $page.Params.item }}
  13. <div class="wg-hero dark carousel-item{{if eq $index 0}} active{{end}}" style="{{with $page.Params.height}}{{printf "height: %s;" . | safeCSS}}{{end}}
  14. {{ if $item.overlay_color }}
  15. background-color: {{ $item.overlay_color | default "transparent" }};
  16. {{ end }}
  17. {{ if $item.overlay_img }}
  18. {{ $media_dir := $.Scratch.Get "media_dir" }}
  19. background-image:
  20. {{ if $item.overlay_filter }}linear-gradient(rgba(0, 0, 0, {{ $item.overlay_filter }}), rgba(0, 0, 0, {{ $item.overlay_filter }})), {{ end }}
  21. url('{{ printf "%s/%s" $media_dir $item.overlay_img | absURL }}');
  22. {{ end }}
  23. ;">
  24. <div class="container" style="text-align: {{$item.align | default "left"}};">
  25. <h1 class="hero-title">
  26. {{ with $item.title }}{{ . | markdownify | emojify }}{{ end }}
  27. </h1>
  28. {{ with $item.content }}
  29. <p class="hero-lead" style="{{if eq $item.align "center"}}margin: 0 auto 0 auto;{{else if eq $item.align "right"}}margin-left: auto; margin-right: 0{{end}}">
  30. {{ . | markdownify | emojify }}
  31. </p>
  32. {{ end }}
  33. {{ if $item.cta_url }}
  34. {{ $pack := or .cta_icon_pack "fas" }}
  35. {{ $pack_prefix := $pack }}
  36. {{ if in (slice "fab" "fas" "far" "fal") $pack }}
  37. {{ $pack_prefix = "fa" }}
  38. {{ end }}
  39. <p>
  40. <a href="{{ $item.cta_url }}" class="btn btn-light btn-lg">
  41. {{- with $item.cta_icon -}}<i class="{{ $pack }} {{ $pack_prefix }}-{{ . }}" style="padding-right: 10px;"></i>{{- end -}}
  42. {{- $item.cta_label | emojify | safeHTML -}}
  43. </a>
  44. </p>
  45. {{ end }}
  46. </div>
  47. </div>
  48. {{ end }}
  49. </div>
  50. <!-- Left and right controls -->
  51. <a class="carousel-control-prev" href="#{{$hash_id}}" data-slide="prev">
  52. <span class="carousel-control-prev-icon"></span>
  53. <span class="sr-only">Previous</span>
  54. </a>
  55. <a class="carousel-control-next" href="#{{$hash_id}}" data-slide="next">
  56. <span class="carousel-control-next-icon"></span>
  57. <span class="sr-only">Next</span>
  58. </a>