Skip to content

Commit 30541d5

Browse files
authored
Merge pull request #1750 from codidact/0valt/1003/article-previews
Add body previews to posts of the Article type
2 parents 5b62588 + 475b53e commit 30541d5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/views/posts/_article_list.html.erb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
<% end %>
2222
<%= link_to post.title, generic_share_link(post), 'data-ckb-item-link' => '' %>
2323
</div>
24+
<% if (SiteSetting['PostBodyListTruncateLength'] || 0) > 0 %>
25+
<p class="post-list--content">
26+
<%= sanitize(strip_tags(post.body).truncate(SiteSetting['PostBodyListTruncateLength'] || 200), scrubber: scrubber) %>
27+
</p>
28+
<% end %>
2429
<p class="has-color-tertiary-600 has-float-right post-list--meta">
2530
posted <span title="<%= post.created_at.iso8601 %>"><%= time_ago_in_words(post.created_at, locale: :en_abbrev) %> ago</span>
2631
by <%= user_link post.user %>

0 commit comments

Comments
 (0)