Skip to content

Commit d2ddc8c

Browse files
authored
Fix for issue #154 - Carousel item can be a link (#343)
* 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
1 parent f3a7e92 commit d2ddc8c

File tree

4 files changed

+49
-33
lines changed

4 files changed

+49
-33
lines changed

README.md

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,37 @@ This Hugo theme was ported from [Bootstrapious](http://bootstrapious.com/p/unive
1717

1818
## Table of Contents
1919

20-
* [Features](#features)
21-
* [Installation](#installation)
22-
* [Configuration](#configuration)
23-
* [Style](#style)
24-
* [Comments](#comments)
25-
* [Google Analytics](#google-analytics)
26-
* [Contact form](#contact-form)
27-
* [Menu](#menu)
28-
* [Sidebar widgets](#sidebar-widgets)
29-
* [Blog post thumbnails](#blog-post-thumbnails)
30-
* [Top bar](#top-bar)
31-
* [Landing page](#landing-page)
32-
* [Carousel](#carousel)
33-
* [Features](#features)
34-
* [Testimonials](#testimonials)
35-
* [See more](#see-more)
36-
* [Clients](#clients)
37-
* [Recent posts](#recent-posts)
38-
* [Footer](#footer)
39-
* [Meta tags](#meta-tags)
40-
* [Usage](#usage)
41-
* [Contributing](#contributing)
42-
* [License](#license)
43-
* [Thanks](#thanks)
20+
- [Universal Theme for Hugo](#universal-theme-for-hugo)
21+
- [Table of Contents](#table-of-contents)
22+
- [Features](#features)
23+
- [Installation](#installation)
24+
- [Configuration](#configuration)
25+
- [Language](#language)
26+
- [Style](#style)
27+
- [Comments](#comments)
28+
- [Google Analytics](#google-analytics)
29+
- [Logo](#logo)
30+
- [Contact form](#contact-form)
31+
- [Menu](#menu)
32+
- [Sidebar widgets](#sidebar-widgets)
33+
- [Top bar](#top-bar)
34+
- [Blog post thumbnails](#blog-post-thumbnails)
35+
- [Landing page](#landing-page)
36+
- [Carousel](#carousel)
37+
- [Features](#features-1)
38+
- [Testimonials](#testimonials)
39+
- [See more](#see-more)
40+
- [Clients](#clients)
41+
- [Recent posts](#recent-posts)
42+
- [Footer](#footer)
43+
- [About us](#about-us)
44+
- [Recent posts](#recent-posts-1)
45+
- [Contact](#contact)
46+
- [Meta tags](#meta-tags)
47+
- [Usage](#usage)
48+
- [Contributing](#contributing)
49+
- [License](#license)
50+
- [Thanks](#thanks)
4451

4552
## Features
4653

@@ -377,9 +384,10 @@ description: >
377384
<li>Easily to change fonts</li>
378385
</ul>
379386
image: "img/carousel/template-easy-code.png"
387+
href: "https://devcows.github.io/hugo-universal-theme/"
380388
```
381389
382-
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.
390+
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).
383391

384392
Once the carousel is configured, some options can be defined like: auto play, speed, etc. in the `config.toml` file.
385393

exampleSite/data/carousel/customizable.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ description: >
66
<li>Easily to change fonts</li>
77
</ul>
88
image: "img/carousel/template-easy-code.png"
9+
href: "https://devcows.github.io/hugo-universal-theme/"

exampleSite/data/carousel/features.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ description: >
88
<li>+ 11 extra pages showing template features</li>
99
</ul>
1010
image: "img/carousel/template-mac.png"
11+
href: "faq"

layouts/partials/carousel.html

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,21 @@
1010
data-pagination-speed="{{ default 1000 .Site.Params.CarouselHomepage.pagination_speed }}">
1111
{{ range sort .Site.Data.carousel "weight" }}
1212
<div class="item">
13-
<div class="row">
14-
<div class="col-sm-5 right">
15-
<h1>{{ .title }}</h1>
16-
{{ .description | safeHTML }}
13+
{{ if .href }}
14+
<a href="{{ .href }}">
15+
{{ end }}
16+
<div class="row">
17+
<div class="col-sm-5 right">
18+
<h1>{{ .title }}</h1>
19+
{{ .description | safeHTML }}
20+
</div>
21+
<div class="col-sm-7">
22+
<img class="img-responsive" src="{{ .image }}" alt="">
23+
</div>
1724
</div>
18-
<div class="col-sm-7">
19-
<img class="img-responsive" src="{{ .image }}" alt="">
20-
</div>
21-
</div>
25+
{{ if .href }}
26+
</a>
27+
{{ end }}
2228
</div>
2329
{{ end }}
2430
</div>

0 commit comments

Comments
 (0)