summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.rb2
-rw-r--r--helpers/blog_helpers.rb8
-rw-r--r--source/_article_summary.html.erb4
3 files changed, 12 insertions, 2 deletions
diff --git a/config.rb b/config.rb
index 93d7cc5..bf12a20 100644
--- a/config.rb
+++ b/config.rb
@@ -16,7 +16,7 @@ activate :blog do |blog|
# blog.summary_separator = /(READMORE)/
# blog.summary_length = 250
- blog.summary_generator = Proc.new {|article, rendered, length, ellipsis| Nokogiri::HTML(rendered).at_xpath("//p[1]").to_s + link_to(ellipsis, article) }
+ # blog.summary_generator = Proc.new {|article, rendered, length, ellipsis| Nokogiri::HTML(rendered).at_xpath("//p[1]").to_s + link_to(ellipsis, article) }
# blog.year_link = "{year}.html"
# blog.month_link = "{year}/{month}.html"
diff --git a/helpers/blog_helpers.rb b/helpers/blog_helpers.rb
new file mode 100644
index 0000000..566d4f8
--- /dev/null
+++ b/helpers/blog_helpers.rb
@@ -0,0 +1,8 @@
+module BlogHelpers
+
+ def article_paragraphs(article)
+ html = Nokogiri::HTML(article.body)
+ html.xpath("//p").map(&:text)
+ end
+
+end
diff --git a/source/_article_summary.html.erb b/source/_article_summary.html.erb
index fbb4cfd..153875c 100644
--- a/source/_article_summary.html.erb
+++ b/source/_article_summary.html.erb
@@ -1,5 +1,7 @@
<% article = article_summary %>
<div>
<h3><%= link_to article.title, article %> <span><%= article.date.strftime('%b %e') %></span></h3>
- <%= article.summary %>
+ <p>
+ <%= article_paragraphs(article).first %> <%= link_to "Mehr >>", article %>
+ </p>
</div>