jekyll-cut-filter

jekyll-cut-filter

jekyll-cut-filter

This is a Liquid filter intended to be used with Jekyll static site generator.

Installation

Copy jekyll-cut.rb file into _plugins directory.

Usage

Use <cut /> tag in .textile files to hide content below it and cut filter in Liquid templates:

{{ post.content | cut }}

Note that <cut /> tag should be removed while rendering full post:

{{ post.content | remove:"<cut />" }}

(Example)

Index: _includes/themes/twitter/post.html
===================================================================
--- _includes/themes/twitter/post.html
+++ _includes/themes/twitter/post.html
@@ -4,7 +4,7 @@
 
 <div class="row">
   <div class="span8">
-    {{ content }}
+    {{ content | remove:"<cut />" }}
     <hr>
     <div class="pagination">
       <ul>

Index: atom.xml
===================================================================
--- atom.xml
+++ atom.xml
@@ -21,7 +21,7 @@
    <link href="{{ site.production_url }}{{ post.url }}"/>
    <updated>{{ post.date | date_to_xmlschema }}</updated>
    <id>{{ site.production_url }}{{ post.id }}</id>
-   <content type="html">{{ post.content | xml_escape }}</content>
+   <content type="html">{{ post.content | remove:"<cut />" | xml_escape }}</content>
  </entry>
  {% endfor %}