I need show only partial blog post... with a "Read more" link to full blog post.
HOME: List last 5 partial/intro posts with Read More.
This is possible in Docpad?
Thanks..
May by
getCuttedContent: (content) ->
i = content.search('<!-- Read more -->')
if i >= 0
content[0..i-1]
else
content
hasReadMore: (content) ->
content.search('<!-- Read more -->') >= 0
and
<% posts = @getCollection('posts') %>
<% for i in [@document.page.startIdx...@document.page.endIdx]: %>
<% document = posts.at(i).toJSON() %>
<article class="post">
<h3><span class="posts_date"><%= @formatDate(document.date) %></span> <a class="post_head" href="<%= document.url %>"><%= document.title %></a></h3>
<div class="post-content"><%- @getCuttedContent(String(document.contentRenderedWithoutLayouts)) %></div>
<% if @hasReadMore(String(document.contentRenderedWithoutLayouts)): %>
<div class="read_more"><a href="<%= document.url %>"><strong>Читать далее →</strong></a></div>
<% end %>
</article>
<% end %>
and add to post
<!-- Read more -->