Browse code

now only excerpted articles show the "read on" link. Also the text for that link can be set in the _config.yml

Brandon Mathis authored on 20/08/2011 at 20:02:37
Showing 3 changed files
... ...
@@ -12,9 +12,12 @@
12 12
 {% endunless %}
13 13
 {% if index %}
14 14
   <div class="entry-content">{{ content | excerpt }}</div>
15
-  <footer>
16
-    <a rel="full-article" href="{{ root_url }}{{ post.url }}">Read on &rarr;</a>
17
-  </footer>
15
+  {% capture excerpted %}{{ content | has_excerpt }}{% endcapture %}
16
+  {% if excerpted == 'true' %}
17
+    <footer>
18
+      <a rel="full-article" href="{{ root_url }}{{ post.url }}">Read on &rarr;</a>
19
+    </footer>
20
+  {% endif %}
18 21
 {% else %}
19 22
 <div class="entry-content">{{ content }}</div>
20 23
 {% endif %}
... ...
@@ -32,6 +32,7 @@ pygments: false # default python pygments have been replaced by pygments.rb
32 32
 paginate: 10          # Posts per page on the blog index
33 33
 pagination_dir: blog  # Directory base for pagination URLs eg. /blog/page/2/
34 34
 recent_posts: 5       # Posts in the sidebar Recent Posts section
35
+excerpt_link: "Read on &rarr;"  # "Continue reading" link text at the bottom of excerpted articles
35 36
 
36 37
 # list each of the sidebar modules you want to include, in the order you want them to appear.
37 38
 # To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html'
... ...
@@ -12,6 +12,11 @@ module OctopressFilters
12 12
     end
13 13
   end
14 14
 
15
+  # Checks for excerpts (helpful for template conditionals)
16
+  def has_excerpt(input)
17
+    input =~ /<!--\s*more\s*-->/i ? true : false
18
+  end
19
+
15 20
   # Summary is used on the Archive pages to return the first block of content from a post.
16 21
   def summary(input)
17 22
     if input.index(/\n\n/)