Skip to content

Instantly share code, notes, and snippets.

@lewisnyman
Created October 7, 2016 11:35
Show Gist options
  • Save lewisnyman/6af3b688b0b0bcb7560dcd748e8831a0 to your computer and use it in GitHub Desktop.
Save lewisnyman/6af3b688b0b0bcb7560dcd748e8831a0 to your computer and use it in GitHub Desktop.
Prevent widows in Jekyll on Github pages
<!-- { Prevent widows without using a liquid filter } -->
{% assign split_title = page.title | split: ' ' %}
{% capture title %}
{% for word in split_title %}{% if forloop.last == true %}&nbsp;{{ word | strip }}{% else %} {{ word }}{% endif %}{% endfor %}
{% endcapture %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment