Created
July 30, 2014 15:23
-
-
Save drewsberry/200e3d3ede16a369b1e6 to your computer and use it in GitHub Desktop.
Jekyll excerpts, split by <!--more--> by default. If not found, default to the first 500 words.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if post.content contains '<!--more-->' %} | |
{{ post.content | split:'<!--more-->' | first %}} | |
<p><a class="btn btn-primary btn-lg" href="{{ post.url }}">Continue reading...</a></p> | |
{% else %} | |
{{ post.content | truncate: 500 }} | |
<p><a class="btn btn-primary btn-lg" href="{{ post.url }}">Continue reading...</a></p> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to be careful if you're automatically truncating that you're not caught in the middle of a code block or other element.