Skip to content

Commit

Permalink
Fix for issue #154 - Carousel item can be a link (#343)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
NetworkSeb authored Feb 17, 2022
1 parent f3a7e92 commit d2ddc8c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 33 deletions.
58 changes: 33 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions exampleSite/data/carousel/customizable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
1 change: 1 addition & 0 deletions exampleSite/data/carousel/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ description: >
<li>+ 11 extra pages showing template features</li>
</ul>
image: "img/carousel/template-mac.png"
href: "faq"
22 changes: 14 additions & 8 deletions layouts/partials/carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit d2ddc8c

Please sign in to comment.