Last active
March 13, 2021 17:56
-
-
Save Phlow/04f635e4d1fc928b1157 to your computer and use it in GitHub Desktop.
This include splits the content of {{ content }} into two parts if Jekyll finds an excerpt separator. This allows extra styling of the first part to enlarge the the fontsize of the teaser for example.
This file contains 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
{% comment %} | |
# | |
# Explanation: | |
# | |
# This include splits the content of {{ content }} into | |
# two parts if Jekyll finds an excerpt separator. This allows | |
# extra styling of the first part to enlarge the the fontsize | |
# of the teaser for example. | |
# | |
# The excerpt separator can be defined directly in your | |
# _config.yml or via front matter. If no separator is defined | |
# Jekyll will fall back to the default separator <!--more-->. | |
# If no separator is set, Jekyll just spits out the content | |
# without splitting. | |
# | |
{% endcomment %} | |
{% capture page_content %}{{ content }}{% endcapture %} | |
{% if site.excerpt_separator %}{% assign separator = site.excerpt_separator %}{% else %}{% assign separator = '<!--more-->' %}{% endif %} | |
{% if page_content contains separator %} | |
{% assign entry = page_content | split: separator %} | |
{{ entry | first | remove: '<p>' | prepend: '<p class="lead">' }} | |
{{ entry | last }} | |
{% else %} | |
{{ page_content }} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment