Skip to content

Commit

Permalink
Add an optional extra link for showcase card (#736)
Browse files Browse the repository at this point in the history
close #735
  • Loading branch information
wey-gu authored Oct 4, 2022
1 parent 6879d59 commit 7405d45
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions assets/css/_partial/_single/_showcase.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ $showcase-hover-color-black: #ffffff;
left: 2%;
}

.showcase-link-extra {
position: absolute;
bottom: 2%;
right: 2%;
}

@media screen and (max-width: 680px) {
.showcase-box {
width: 100% !important;
Expand Down
4 changes: 3 additions & 1 deletion exampleSite/content/posts/tests/showcase-tests/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ hiddenFromSearch: true

<!--more-->

{{< showcase title="Theme Documentation - Basics" summary="Discover what the Hugo - DoIt theme is all about and the core-concepts behind it." image="/theme-documentation-basics/featured-image.webp" link="/theme-documentation-basics" column="3" >}}
{{< showcase title="Theme Documentation - Basics" summary="Discover what the Hugo - DoIt theme is all about and the core-concepts behind it." image="/theme-documentation-basics/featured-image.webp" link="/theme-documentation-basics" column="3" linkExtra="/theme-documentation-basics/featured-image.webp">}}

{{< showcase title="Theme Documentation - Content" summary="Find out how to create and organize your content quickly and intuitively in DoIt theme." image="/theme-documentation-content/featured-image.webp" link="/theme-documentation-content" column="3" >}}

Expand All @@ -25,3 +25,5 @@ hiddenFromSearch: true
{{< showcase title="Seal!" summary="Awww" image="https://i.pinimg.com/originals/b8/75/9a/b8759a1b9575a1f938a16f7b5c5287fe.jpg" link="https://i.pinimg.com/originals/b8/75/9a/b8759a1b9575a1f938a16f7b5c5287fe.jpg" column="3" >}}

{{< showcase "Cat!" "Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ " "https://img.webmd.com/dtmcms/live/webmd/consumer_assets/site_images/article_thumbnails/other/cat_relaxing_on_patio_other/1800x1200_cat_relaxing_on_patio_other.jpg" "https://img.webmd.com/dtmcms/live/webmd/consumer_assets/site_images/article_thumbnails/other/cat_relaxing_on_patio_other/1800x1200_cat_relaxing_on_patio_other.jpg" "3" >}}

{{< showcase "Cat!" "Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ Miaow~ " "https://img.webmd.com/dtmcms/live/webmd/consumer_assets/site_images/article_thumbnails/other/cat_relaxing_on_patio_other/1800x1200_cat_relaxing_on_patio_other.jpg" "https://img.webmd.com/dtmcms/live/webmd/consumer_assets/site_images/article_thumbnails/other/cat_relaxing_on_patio_other/1800x1200_cat_relaxing_on_patio_other.jpg" "3" "https://img.webmd.com/dtmcms/live/webmd/consumer_assets/site_images/article_thumbnails/other/cat_relaxing_on_patio_other/1800x1200_cat_relaxing_on_patio_other.jpg">}}
9 changes: 9 additions & 0 deletions layouts/shortcodes/showcase.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
{{- $link := "" -}}
{{- $summary := "" -}}
{{- $column := "2" -}}
{{- $linkExtra := "" -}}
{{ if .IsNamedParams }}
{{- $title = .Get "title" | default $title -}}
{{- $summary = .Get "summary" | default $summary -}}
{{- $link = .Get "link" | default $link -}}
{{- $image = .Get "image" | default $image -}}
{{- $column = .Get "column" | default $column -}}
{{- $linkExtra = .Get "link_extra" | default $linkExtra -}}
{{- else -}}
{{- $title = .Get 0 | default $title -}}
{{- $summary = .Get 1 | default $summary -}}
{{- $image = .Get 2 | default $image -}}
{{- $link = .Get 3 | default $link -}}
{{- $column = .Get 4 | default $column -}}
{{- $linkExtra = .Get 5 | default $linkExtra -}}

{{ end }}
<div class="showcase-box column-{{ $column }}">
<div class="showcase-image">
Expand All @@ -31,4 +35,9 @@ <h2 class="showcase-title">
<a class="showcase-link" href={{ $link }}>
{{ T "readMore" }}
</a>
{{- if .Get "linkExtra" -}}
<a class="showcase-link-extra" href={{ $linkExtra }}>
{{ T "abstract" }}
</a>
{{ end }}
</div>

1 comment on commit 7405d45

@vercel
Copy link

@vercel vercel bot commented on 7405d45 Oct 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.