diff options
author | Zachary Betz <zwbetz@gmail.com> | 2018-12-28 06:39:07 +0300 |
---|---|---|
committer | Zachary Betz <zwbetz@gmail.com> | 2018-12-28 06:39:07 +0300 |
commit | 5300dd9f0effb9cb08c18ebd3e360bf16d4ced97 (patch) | |
tree | f218146e6bb042297f7aa46fdd0d8c7cabbd0c9f | |
parent | c39409dc7e07b9bc0e141c29a6a2a4aff181bbce (diff) |
Only show card body when title or text populated
-rw-r--r-- | exampleSite/content/post/nasa-images/index.md | 2 | ||||
-rw-r--r-- | layouts/shortcodes/bootstrap-card.html | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/exampleSite/content/post/nasa-images/index.md b/exampleSite/content/post/nasa-images/index.md index a700102..1df039c 100644 --- a/exampleSite/content/post/nasa-images/index.md +++ b/exampleSite/content/post/nasa-images/index.md @@ -31,4 +31,4 @@ text="Behold one of the more detailed images of the Earth yet created. This Blue alt="earth" command="Resize" options="700x" -class="mb-3" >}}
\ No newline at end of file +class="mb-3" >}} diff --git a/layouts/shortcodes/bootstrap-card.html b/layouts/shortcodes/bootstrap-card.html index b8f77a8..2551a95 100644 --- a/layouts/shortcodes/bootstrap-card.html +++ b/layouts/shortcodes/bootstrap-card.html @@ -15,12 +15,14 @@ <a href="{{ $original.Permalink }}"> <img src="{{ $new.Permalink }}" class="card-img-top" alt="{{ .Get "alt" }}"> </a> - <div class="card-body"> - {{ with (.Get "title") }} - <h5 class="card-title">{{ . | markdownify }}</h5> + {{ if or (.Get "title") (.Get "text") }} + <div class="card-body"> + {{ with (.Get "title") }} + <h5 class="card-title">{{ . | markdownify }}</h5> + {{ end }} + {{ with (.Get "text") }} + <p class="card-text">{{ . | markdownify }}</p> + {{ end }} + </div> {{ end }} - {{ with (.Get "text") }} - <p class="card-text">{{ . | markdownify }}</p> - {{ end }} - </div> </div>
\ No newline at end of file |