Last active
August 14, 2017 16:46
-
-
Save manbearwolf/24ceb4c422750979d4f9327b7e896f71 to your computer and use it in GitHub Desktop.
Jekyll post excerpt http://frontendcollisionblog.com/jekyll/snippet/2015/03/23/how-to-show-a-summary-of-your-post-with-jekyll.html
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
| <!-- index.html --> | |
| <p class="post-excerpt"> | |
| {% if post.content contains '<!--excerpt.start-->' and post.content contains '<!--excerpt.end-->' %} | |
| {{ ((post.content | split:'<!--excerpt.start-->' | last) | split: '<!--excerpt.end-->' | first) | strip_html | truncatewords: 20 }} | |
| {% else %} | |
| {{ post.content | strip_html | truncatewords: 20 }} | |
| {% endif %} | |
| </p> | |
| <!-- _posts/some-random-post.html --> | |
| <p> | |
| Here's all my content, and <!--excerpt.start-->here's where I want my summary to begin, and this is where I want it to end<!--excerpt.end-->. | |
| </p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment