Skip to content

Commit

Permalink
fix: empty featured placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
wangchucheng committed Dec 17, 2020
1 parent f1e1ec9 commit 8f5a4d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions layouts/partials/get_featured.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{ $video := partial "get_video" (dict "context" . "url" .Params.featuredVideo "keyword" "*featured*") }}
{{ $image := partial "get_image.html" (dict "context" . "url" .Params.featuredImage "keyword" "*featured*") }}
{{ $featured := ""}}
{{ if $video }}
{{ $video }}
{{ $featured = $video }}
{{ else if $image }}
<img src="{{ $image }}" class="w-full" alt="Featured Image">
{{ end }}
{{ $featured = print "<img src=\"" $image "\" class=\"w-full\" alt=\"Featured Image\">" | safeHTML }}
{{ end }}
{{ return $featured }}
5 changes: 3 additions & 2 deletions layouts/partials/horizontal_summary.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div class="flex flex-col-reverse lg:flex-row justify-between">
<div class="w-full lg:w-2/3">
{{ $featured := partial "get_featured" . }}
<div class="w-full {{ with $featured }}lg:w-2/3{{ end }}">
<div class="my-2">
<div class="mb-4">
<a href="{{ .Permalink }}" class="font-bold text-xl hover:text-eureka">{{ .LinkTitle }}</a>
Expand Down Expand Up @@ -33,7 +34,7 @@
{{ partial "post_metadata.html" . }}
{{ end }}
</div>
{{ $featured := partial "get_featured" . }}

{{ with $featured }}
<div class="w-full lg:w-1/3 mb-4 lg:mb-0 lg:ml-8">
{{ . }}
Expand Down

0 comments on commit 8f5a4d0

Please sign in to comment.