From beaa10b6741411cfd29658c97dd57e8beb5d5773 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Thu, 9 Aug 2018 22:37:44 +0100 Subject: [PATCH] widgets: Add carousel Close #622 --- exampleSite/content/home/hero_carousel.md | 57 +++++++++++++++++++ layouts/partials/widget_page.html | 2 +- layouts/partials/widgets/hero_carousel.html | 61 +++++++++++++++++++++ 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 exampleSite/content/home/hero_carousel.md create mode 100644 layouts/partials/widgets/hero_carousel.html diff --git a/exampleSite/content/home/hero_carousel.md b/exampleSite/content/home/hero_carousel.md new file mode 100644 index 00000000..19de9b33 --- /dev/null +++ b/exampleSite/content/home/hero_carousel.md @@ -0,0 +1,57 @@ ++++ +# Hero Carousel widget. +widget = "hero_carousel" +active = false +date = 2017-10-15T00:00:00 + +# Order that this section will appear in. +weight = 1 + +# Slide interval. +# Use `false` to disable animation or enter a time in ms, e.g. `5000` (5s). +interval = false + +# Minimum slide height. +# Specify a height to ensure a consistent height for each slide. +height = "300px" + +# Slides. +# Duplicate an `[[item]]` block to add more slides. +[[item]] + title = "Hello" + content = "I am center aligned :smile:" + align = "center" # Choose `center`, `left`, or `right`. + + # Overlay a color or image (optional). + # Deactivate an option by commenting out the line, prefixing it with `#`. + overlay_color = "#666" # An HTML color value. + overlay_img = "headers/bubbles-wide.jpg" # Image path relative to your `static/img/` folder. + overlay_filter = 0.5 # Darken the image. Value in range 0-1. + + # Call to action button (optional). + # Activate the button by specifying a URL and button label below. + # Deactivate by commenting out parameters, prefixing lines with `#`. + cta_label = "Get Academic" + cta_url = "https://sourcethemes.com/academic/" + cta_icon_pack = "fa" + cta_icon = "graduation-cap" + +[[item]] + title = "Left" + content = "I am left aligned :smile:" + align = "left" + + overlay_color = "#555" # An HTML color value. + overlay_img = "" # Image path relative to your `static/img/` folder. + overlay_filter = 0.5 # Darken the image. Value in range 0-1. + +[[item]] + title = "Right" + content = "I am right aligned :smile:" + align = "right" + + overlay_color = "#333" # An HTML color value. + overlay_img = "" # Image path relative to your `static/img/` folder. + overlay_filter = 0.5 # Darken the image. Value in range 0-1. + ++++ diff --git a/layouts/partials/widget_page.html b/layouts/partials/widget_page.html index 6268ac5b..1205e701 100644 --- a/layouts/partials/widget_page.html +++ b/layouts/partials/widget_page.html @@ -15,7 +15,7 @@ {{ range $index, $page := where (where .Data.Pages "Section" $section) ".Params.active" "!=" false }} {{ $params := dict "root" $ "page" $page }} {{ $widget := printf "widgets/%s.html" ( or $page.Params.widget "custom" ) }} - {{ if eq $page.Params.widget "hero" }} + {{ if in (slice "hero" "hero_carousel") $page.Params.widget }} {{ partial $widget $params }} {{ else }}
diff --git a/layouts/partials/widgets/hero_carousel.html b/layouts/partials/widgets/hero_carousel.html new file mode 100644 index 00000000..a0c604c4 --- /dev/null +++ b/layouts/partials/widgets/hero_carousel.html @@ -0,0 +1,61 @@ +{{ $ := .root }} +{{ $page := .page }} + +