Skip to content

Commit

Permalink
fix: blogcardでdescriptionが取得できないとコードが表示される
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Feb 13, 2024
1 parent c02441b commit 81bc078
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions assets/scss/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
.blog-card-content {
min-width: 0; /* これ無いと ellipsis が正常に動作しない */
padding: 0.5rem;
height: 100%;
& .blog-card-title {
color: var(--card-text-color-main);
font-size: 1.5rem;
Expand Down
24 changes: 15 additions & 9 deletions layouts/shortcodes/blogcard.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@

{{ $parsed_url := urls.Parse $url }}


<div class="blog-card">
<div class="blog-card-thumb" style="background-image: url('{{ $og.thumbnail }}')"></div>
<div class="blog-card-content">
<div class="blog-card-title">{{ $og.title }}</div>
<p class="blog-card-description">
{{ replace ($og.description | plainify) "\n" "" }}
</p>
<a href="{{ $og.url }}" target="_blank" rel="noopener noreferrer">{{ $parsed_url.Host }}</a>
</div>
<div
class="blog-card-thumb"
style="background-image: url('{{ $og.thumbnail }}')"
></div>
<div class="blog-card-content">
<div class="blog-card-title">{{ $og.title }}</div>
{{- if $og.description -}}
<p class="blog-card-description">
{{ replace ($og.description | plainify) "\n" ""}}
</p>
{{- end -}}
<a href="{{ $og.url }}" target="_blank" rel="noopener noreferrer">
{{ $parsed_url.Host }}
</a>
</div>
</div>

0 comments on commit 81bc078

Please sign in to comment.