diff --git a/assets/sass/academic/_widgets.scss b/assets/sass/academic/_widgets.scss index bc5ef0c8..8cc42865 100644 --- a/assets/sass/academic/_widgets.scss +++ b/assets/sass/academic/_widgets.scss @@ -205,6 +205,13 @@ a.hero-cta-alt:hover { * Slider Widget **************************************************/ +/* Clear `.home-section` as padding and animation interferes with Slider's layout and animations. */ +.home-section.wg-slider { + padding: 0; + animation: none; + animation-delay: unset; +} + /* The Slider widget reuses the Hero widget's `.wg-hero` class. * We must remove the `animation` and `clear` in this instance or * multiple slides can be `.active` at once. */ diff --git a/exampleSite/content/home/slider.md b/exampleSite/content/home/slider.md index a23a6f55..6ddc3be9 100644 --- a/exampleSite/content/home/slider.md +++ b/exampleSite/content/home/slider.md @@ -9,6 +9,10 @@ weight = 1 # Order that this section will appear. # Use `false` to disable animation or enter a time in ms, e.g. `5000` (5s). interval = false +# Slide height (optional). +# E.g. `500px` for 500 pixels or `calc(100vh - 70px)` for full screen. +height = "" + # Slides. # Duplicate an `[[item]]` block to add more slides. [[item]] diff --git a/layouts/partials/widget_page.html b/layouts/partials/widget_page.html index b476e08d..dc19bc4e 100644 --- a/layouts/partials/widget_page.html +++ b/layouts/partials/widget_page.html @@ -49,7 +49,7 @@ {{ $style = print $style . }} {{ end }} - {{ $params := dict "root" $ "page" $st }} + {{/* Fix Hugo's ContentBaseName returning wrong file base name when page section is within a bundle. */}} {{ $hash_id := replace $st.File.ContentBaseName "index" (path.Base (path.Split .Path).Dir) }} {{ $widget := or $st.Params.widget "blank" }} @@ -57,15 +57,23 @@ {{ if eq $widget "projects" }}{{ $widget = "portfolio" }}{{ end }}{{/* Support legacy Projects widget */}} {{ $widget_path := printf "widgets/%s.html" $widget }} + {{ $widget_args := dict "root" $ "page" $st "hash_id" $hash_id }} + {{ $css_classes := $st.Params.advanced.css_class | default "" }} + {{ $extra_attributes := "" }} + {{ $use_container := true }} + + {{/* Special case: Slider widget. */}} {{ if in (slice "slider") $widget }} - {{ partial $widget_path $params }} - {{ else }} -
-
- {{ partial $widget_path $params }} -
-
+ {{ $css_classes = print $css_classes " carousel slide" }} + {{ $extra_attributes = printf "data-ride=\"carousel\" data-interval=\"%s\"" (string $st.Params.interval | default "5000") }} + {{ $use_container = false }} {{ end }} + +
+ {{if $use_container}}
{{end}} + {{ partial $widget_path $widget_args }} + {{if $use_container}}
{{end}} +
{{ end }} {{ partial "footer_container.html" . }} diff --git a/layouts/partials/widgets/slider.html b/layouts/partials/widgets/slider.html index 391627f3..a8339af5 100644 --- a/layouts/partials/widgets/slider.html +++ b/layouts/partials/widgets/slider.html @@ -1,61 +1,58 @@ {{ $ := .root }} {{ $page := .page }} +{{ $hash_id := .hash_id }} - + + + + Previous + + + + Next +