Skip to content

Commit

Permalink
feat: allow card without cover img (even without default cover)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcticLampyrid committed Jun 2, 2024
1 parent e9c55e5 commit 26137b9
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions layout/_index_style/card.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@
</div>
<% } %>
<div class="kratos-entry-post-main">
<div class="kratos-entry-thumb">
<a href="<%- url_for(post.path) %>">
<img class="kratos-entry-thumb-img" src="<%-
post.cover ? (
/^(#|\/\/|http(s)?:)/.test(post.cover) ?
post.cover :
url_for(
post.cover.startsWith('/') ?
post.cover :
post.path.replace(/(\/index)?\.html?$/, '') + '/' + post.cover
)
) : theme.posts.default_cover
%>" alt="<%- url_for(post.title) %>">
</a>
</div>
<% let cover = post.cover === undefined ? theme.posts.default_cover : (
post.cover ? (
/^(#|\/\/|http(s)?:)/.test(post.cover) ?
post.cover :
url_for(
post.cover.startsWith('/') ?
post.cover :
post.path.replace(/(\/index)?\.html?$/, '') + '/' + post.cover
)
) : null
); %>
<% if (cover) { %>
<div class="kratos-entry-thumb">
<a href="<%- url_for(post.path) %>">
<img class="kratos-entry-thumb-img" src="<%- cover %>" alt="<%- url_for(post.title) %>">
</a>
</div>
<% } %>
<div class="kratos-entry-post-inner">
<header class="kratos-entry-header">
<%- list_categories(post.categories, {
Expand Down

0 comments on commit 26137b9

Please sign in to comment.