diff --git a/layouts/partials/_tile.erb b/layouts/partials/_tile.erb index 63135af..263eaaa 100644 --- a/layouts/partials/_tile.erb +++ b/layouts/partials/_tile.erb @@ -1,5 +1,5 @@ - +
@@ -14,7 +14,7 @@
- <%= @article[:description] %> + <%= @article[:description] %>
<%= get_teaser(@article) %> diff --git a/lib/helpers/tile_helper.rb b/lib/helpers/tile_helper.rb index 29636d4..0c55a1c 100644 --- a/lib/helpers/tile_helper.rb +++ b/lib/helpers/tile_helper.rb @@ -1,14 +1,7 @@ - module TileHelper def get_teaser(post) - content = strip_html(post.compiled_content) - return truncate(content, 300) + # excerptize is part of the TextHelper, given by nanoc + # https://nanoc.ws/doc/reference/helpers/#text + excerptize(post.reps[:text].compiled_content, length: 300) end - - def truncate(s, max=70, elided = ' ...') - s.match( /(.{1,#{max}})(?:\s|\z)/ )[1].tap do |res| - res << elided unless res.length == s.length - end - end - end