Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Breakpoints in Sculpin
...
<div>
{# Split the post into an array using explode().
Because we provide a length of 2, the remainder
of the post will be stored in the second array
element, even if there are multiple breakpoints. #}
{% set break_array =
post.blocks.content|split('<!-- break -->', 2) %}
{# Output the first element of the array in raw mode #}
{{ break_array[0]|raw }}
{# Detect if there is more to the post. If the post
was only one array element with no breakpoints,
it would all have shown up. This Read More link should
only show up if there is overflow to the post. #}
{% if break_array|length > 1 %}
<p><a href="{{ site.url }}{{ post.url }}">
Read more of this post &raquo;
</a></p>
{% endif %}
</div>
...
@hackzilla

This comment has been minimized.

Copy link

hackzilla commented Sep 29, 2014

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.