slider.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. background-image:
  19. {{ if $item.overlay_filter }}linear-gradient(rgba(0, 0, 0, {{ $item.overlay_filter }}), rgba(0, 0, 0, {{ $item.overlay_filter }})), {{ end }}
  20. url('{{ printf "img/%s" $item.overlay_img | absURL }}');
  21. {{ end }}
  22. ;">
  23. <div class="container" style="text-align: {{$item.align | default "left"}};">
  24. <h1 class="hero-title">
  25. {{ with $item.title }}{{ . | markdownify | emojify }}{{ end }}
  26. </h1>
  27. {{ with $item.content }}
  28. <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}}">
  29. {{ . | markdownify | emojify }}
  30. </p>
  31. {{ end }}
  32. {{ if $item.cta_url }}
  33. {{ $pack := or .cta_icon_pack "fas" }}
  34. {{ $pack_prefix := $pack }}
  35. {{ if in (slice "fab" "fas" "far" "fal") $pack }}
  36. {{ $pack_prefix = "fa" }}
  37. {{ end }}
  38. <p>
  39. <a href="{{ $item.cta_url }}" class="btn btn-light btn-lg">
  40. {{- with $item.cta_icon -}}<i class="{{ $pack }} {{ $pack_prefix }}-{{ . }}" style="padding-right: 10px;"></i>{{- end -}}
  41. {{- $item.cta_label | emojify | safeHTML -}}
  42. </a>
  43. </p>
  44. {{ end }}
  45. </div>
  46. </div>
  47. {{ end }}
  48. </div>
  49. <!-- Left and right controls -->
  50. <a class="carousel-control-prev" href="#{{$hash_id}}" data-slide="prev">
  51. <span class="carousel-control-prev-icon"></span>
  52. <span class="sr-only">Previous</span>
  53. </a>
  54. <a class="carousel-control-next" href="#{{$hash_id}}" data-slide="next">
  55. <span class="carousel-control-next-icon"></span>
  56. <span class="sr-only">Next</span>
  57. </a>