From 596ec87c37d4f848e478abbbd0690e52eeb37db1 Mon Sep 17 00:00:00 2001 From: Brandon Mathis Date: Sat, 20 Aug 2011 16:02:37 -0400 Subject: now only excerpted articles show the "read on" link. Also the text for that link can be set in the _config.yml --- .themes/classic/source/_includes/article.html | 9 ++++++--- _config.yml | 1 + plugins/octopress_filters.rb | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.themes/classic/source/_includes/article.html b/.themes/classic/source/_includes/article.html index 6b3fb045..fe4e9570 100644 --- a/.themes/classic/source/_includes/article.html +++ b/.themes/classic/source/_includes/article.html @@ -12,9 +12,12 @@ {% endunless %} {% if index %}
{{ content | excerpt }}
- + {% capture excerpted %}{{ content | has_excerpt }}{% endcapture %} + {% if excerpted == 'true' %} + + {% endif %} {% else %}
{{ content }}
{% endif %} diff --git a/_config.yml b/_config.yml index 403f9ba8..00dc8aa4 100644 --- a/_config.yml +++ b/_config.yml @@ -32,6 +32,7 @@ pygments: false # default python pygments have been replaced by pygments.rb paginate: 10 # Posts per page on the blog index pagination_dir: blog # Directory base for pagination URLs eg. /blog/page/2/ recent_posts: 5 # Posts in the sidebar Recent Posts section +excerpt_link: "Read on →" # "Continue reading" link text at the bottom of excerpted articles # list each of the sidebar modules you want to include, in the order you want them to appear. # To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html' diff --git a/plugins/octopress_filters.rb b/plugins/octopress_filters.rb index 1170f8b6..a63c43ab 100644 --- a/plugins/octopress_filters.rb +++ b/plugins/octopress_filters.rb @@ -12,6 +12,11 @@ module OctopressFilters end end + # Checks for excerpts (helpful for template conditionals) + def has_excerpt(input) + input =~ //i ? true : false + end + # Summary is used on the Archive pages to return the first block of content from a post. def summary(input) if input.index(/\n\n/) -- cgit v1.2.1