Skip to content

Instantly share code, notes, and snippets.

@manbearwolf
Last active August 14, 2017 16:46
Show Gist options
  • Select an option

  • Save manbearwolf/24ceb4c422750979d4f9327b7e896f71 to your computer and use it in GitHub Desktop.

Select an option

Save manbearwolf/24ceb4c422750979d4f9327b7e896f71 to your computer and use it in GitHub Desktop.
<!-- 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