diff options
author | Seb Harrington <seb@cdal.co.uk> | 2022-02-18 02:25:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-18 02:25:35 +0300 |
commit | d2ddc8c857fe965c97edaa09ec380761820ce6d8 (patch) | |
tree | 36863db199f3d0ce248692dec8c9589ba3e3011c | |
parent | f3a7e92a67d61372da0d5381dedea03e7fcc2f5b (diff) |
Fix for issue #154 - Carousel item can be a link (#343)1.3
* Fix for issue #154 - .href in md file specifies link for entire carousel item.
* Fix for issue #154 - .href in md file specifies link for entire carousel item.
* Updated README.md to include new href functionality.
Updated customizable.yaml and features.yaml in exampleSite to provide examples.
* Update faq link to be correct in features.yaml
-rw-r--r-- | README.md | 58 | ||||
-rw-r--r-- | exampleSite/data/carousel/customizable.yaml | 1 | ||||
-rw-r--r-- | exampleSite/data/carousel/features.yaml | 1 | ||||
-rw-r--r-- | layouts/partials/carousel.html | 22 |
4 files changed, 49 insertions, 33 deletions
@@ -17,30 +17,37 @@ This Hugo theme was ported from [Bootstrapious](http://bootstrapious.com/p/unive ## Table of Contents -* [Features](#features) -* [Installation](#installation) -* [Configuration](#configuration) - * [Style](#style) - * [Comments](#comments) - * [Google Analytics](#google-analytics) - * [Contact form](#contact-form) - * [Menu](#menu) - * [Sidebar widgets](#sidebar-widgets) - * [Blog post thumbnails](#blog-post-thumbnails) - * [Top bar](#top-bar) - * [Landing page](#landing-page) - * [Carousel](#carousel) - * [Features](#features) - * [Testimonials](#testimonials) - * [See more](#see-more) - * [Clients](#clients) - * [Recent posts](#recent-posts) - * [Footer](#footer) - * [Meta tags](#meta-tags) -* [Usage](#usage) -* [Contributing](#contributing) -* [License](#license) -* [Thanks](#thanks) +- [Universal Theme for Hugo](#universal-theme-for-hugo) + - [Table of Contents](#table-of-contents) + - [Features](#features) + - [Installation](#installation) + - [Configuration](#configuration) + - [Language](#language) + - [Style](#style) + - [Comments](#comments) + - [Google Analytics](#google-analytics) + - [Logo](#logo) + - [Contact form](#contact-form) + - [Menu](#menu) + - [Sidebar widgets](#sidebar-widgets) + - [Top bar](#top-bar) + - [Blog post thumbnails](#blog-post-thumbnails) + - [Landing page](#landing-page) + - [Carousel](#carousel) + - [Features](#features-1) + - [Testimonials](#testimonials) + - [See more](#see-more) + - [Clients](#clients) + - [Recent posts](#recent-posts) + - [Footer](#footer) + - [About us](#about-us) + - [Recent posts](#recent-posts-1) + - [Contact](#contact) + - [Meta tags](#meta-tags) + - [Usage](#usage) + - [Contributing](#contributing) + - [License](#license) + - [Thanks](#thanks) ## Features @@ -377,9 +384,10 @@ description: > <li>Easily to change fonts</li> </ul> image: "img/carousel/template-easy-code.png" +href: "https://devcows.github.io/hugo-universal-theme/" ``` -The `weight` field determines the position of the entry. `title` is a text-only field. The `description` field accepts HTML code. And the `image` must contain the relative path to the image inside the `static` directory. +The `weight` field determines the position of the entry. `title` is a text-only field. The `description` field accepts HTML code. The `image` must contain the relative path to the image inside the `static` directory. The optional `href` field contains a relative or absolute url that the user will be redirected to when clicking the carousel (specific to each carousel item). Once the carousel is configured, some options can be defined like: auto play, speed, etc. in the `config.toml` file. diff --git a/exampleSite/data/carousel/customizable.yaml b/exampleSite/data/carousel/customizable.yaml index 6112d05..29fbdc9 100644 --- a/exampleSite/data/carousel/customizable.yaml +++ b/exampleSite/data/carousel/customizable.yaml @@ -6,3 +6,4 @@ description: > <li>Easily to change fonts</li> </ul> image: "img/carousel/template-easy-code.png" +href: "https://devcows.github.io/hugo-universal-theme/" diff --git a/exampleSite/data/carousel/features.yaml b/exampleSite/data/carousel/features.yaml index 8b30ab2..f5db1b1 100644 --- a/exampleSite/data/carousel/features.yaml +++ b/exampleSite/data/carousel/features.yaml @@ -8,3 +8,4 @@ description: > <li>+ 11 extra pages showing template features</li> </ul> image: "img/carousel/template-mac.png" +href: "faq" diff --git a/layouts/partials/carousel.html b/layouts/partials/carousel.html index be6c6f0..a329dc2 100644 --- a/layouts/partials/carousel.html +++ b/layouts/partials/carousel.html @@ -10,15 +10,21 @@ data-pagination-speed="{{ default 1000 .Site.Params.CarouselHomepage.pagination_speed }}"> {{ range sort .Site.Data.carousel "weight" }} <div class="item"> - <div class="row"> - <div class="col-sm-5 right"> - <h1>{{ .title }}</h1> - {{ .description | safeHTML }} + {{ if .href }} + <a href="{{ .href }}"> + {{ end }} + <div class="row"> + <div class="col-sm-5 right"> + <h1>{{ .title }}</h1> + {{ .description | safeHTML }} + </div> + <div class="col-sm-7"> + <img class="img-responsive" src="{{ .image }}" alt=""> + </div> </div> - <div class="col-sm-7"> - <img class="img-responsive" src="{{ .image }}" alt=""> - </div> - </div> + {{ if .href }} + </a> + {{ end }} </div> {{ end }} </div> |