Since I had been using WordPress1 before, after switching to Jekyll I naturally wanted to find a way to recognize <!-- more --> for truncating output.
Plugins
After a quick Google search, I found relevant plugins:
- jekyll-only_first_p: A plugin that outputs only the first paragraph requires Nokogiri support
- excerpt.rb: A plugin that recognizes
<!-- more -->
However, if your Jekyll is also hosted on GitHub, you can’t use plugins.
For security reasons, GitHub runs Jekyll with the --safe parameter, rendering all third-party plugins ineffective.
Liquid
Just when I was feeling a bit disappointed, I found this article: Post excerpts in Jekyll2
You can achieve this using a filter in the Liquid template language:
{{ post.content | split: "<!-- more -->" | first }}
Then add a Read More link after the truncated article:
<a href="#more>Read More →</a>
This way, even Jekyll hosted on GitHub can have truncated output.3
Notes added on 2018-10-10