Files
HugoBlox-kit/layouts/partials/widgets/slider.html
T
George Cushen d9ff93a1c2 feat: make media library dir configurable
Move default media library from static/img/ to static/media/ as it can now contain audio, video, and other kinds of media in addition to images.

BREAKING CHANGE:
Either rename your site's static/img/ to static/media/ (and update any references to this folder in your Markdown files);

Or, add `media_dir = "img"` to `params.toml` to continue using the legacy location.
2020-07-29 18:54:28 +01:00

64 lines
2.4 KiB
HTML

{{ $ := .root }}
{{ $page := .page }}
{{ $hash_id := .hash_id }}
<!-- Indicators -->
<ol class="carousel-indicators">
{{ range $index, $item := $page.Params.item }}
<li data-target="#{{$hash_id}}" data-slide-to="{{$index}}" {{if eq $index 0}}class="active"{{end}}></li>
{{ end }}
</ol>
<!-- Carousel slides wrapper -->
<div class="carousel-inner">
{{ range $index, $item := $page.Params.item }}
<div class="wg-hero dark carousel-item{{if eq $index 0}} active{{end}}" style="{{with $page.Params.height}}{{printf "height: %s;" . | safeCSS}}{{end}}
{{ if $item.overlay_color }}
background-color: {{ $item.overlay_color | default "transparent" }};
{{ end }}
{{ if $item.overlay_img }}
{{ $media_dir := $.Scratch.Get "media_dir" }}
background-image:
{{ if $item.overlay_filter }}linear-gradient(rgba(0, 0, 0, {{ $item.overlay_filter }}), rgba(0, 0, 0, {{ $item.overlay_filter }})), {{ end }}
url('{{ printf "%s/%s" $media_dir $item.overlay_img | absURL }}');
{{ end }}
;">
<div class="container" style="text-align: {{$item.align | default "left"}};">
<h1 class="hero-title">
{{ with $item.title }}{{ . | markdownify | emojify }}{{ end }}
</h1>
{{ with $item.content }}
<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}}">
{{ . | markdownify | emojify }}
</p>
{{ end }}
{{ if $item.cta_url }}
{{ $pack := or .cta_icon_pack "fas" }}
{{ $pack_prefix := $pack }}
{{ if in (slice "fab" "fas" "far" "fal") $pack }}
{{ $pack_prefix = "fa" }}
{{ end }}
<p>
<a href="{{ $item.cta_url }}" class="btn btn-light btn-lg">
{{- with $item.cta_icon -}}<i class="{{ $pack }} {{ $pack_prefix }}-{{ . }}" style="padding-right: 10px;"></i>{{- end -}}
{{- $item.cta_label | emojify | safeHTML -}}
</a>
</p>
{{ end }}
</div>
</div>
{{ end }}
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#{{$hash_id}}" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#{{$hash_id}}" data-slide="next">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>