jekyll: Excerpt.extract_excerpt() fails when first paragraph contains part of a multi-line Liquid tag.
- I believe this to be a bug, not a question about using Jekyll.
- I updated to the latest Jekyll (or) if on GitHub Pages to the latest
github-pages
- I read the CONTRIBUTION file at https://jekyllrb.com/docs/contributing/
- This is a feature request.
- I am on (or have tested on) macOS 10+
- I am on (or have tested on) Debian/Ubuntu GNU/Linux
- I am on (or have tested on) Fedora GNU/Linux
- I am on (or have tested on) Arch GNU/Linux
- I am on (or have tested on) Other GNU/Linux
- I am on (or have tested on) Windows 10+
- I was trying to install.
- There is a broken Plugin API.
- I had an error on GitHub Pages, and I have reproduced it locally.
- I had an error on GitHub Pages, and GitHub Support said it was a Jekyll Bug.
- I had an error on GitHub Pages and I did not test it locally.
- I was trying to build.
- It was another bug.
My Reproduction Steps
- Create a default Jekyll site with
jekyll new jekyll-issue
cd jekyll-issue
- Edit
_posts/YYYY-MM-DD-welcome-to-jekyll.markdown
:
- NOTE: Leave the YAML front matter untouched
- Remove all Markdown content before the Ruby code sample
- Insert an empty line somewhere in the middle of the Ruby code sample
- Run
jekyll build
jekyll build
exits with error “Liquid Exception: undefined method `t’ for nil:NilClass in _posts/YYYY-MM-DD-welcome-to-jekyll.markdown/#excerpt”
The Output I Wanted
A Welcome to Jekyll post which starts with a Ruby code sample that has empty lines in it for readability.
Work Around 1
Don’t put any empty lines in the code sample.
Work Around 2
Add some other Markdown content before the before the Ruby code sample (a Markdown comment works well for this). Note that adding content after the Ruby code sample does not work.
My System
- Jekyll 3.0.1
- Ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
- Ubuntu 16.04.1
/cc include any Jekyll affinity teams here (see https://teams.jekyllrb.com/ for more info)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (14 by maintainers)
Commits related to this issue
- Fix code samples breaking the build - It has to do with the default excerpt separator in Jekyll. See [this issue on Github][1]. [1]: https://github.com/jekyll/jekyll/issues/5596#issuecomment-26242... — committed to jlapolla/software-design-rules by jlapolla 8 years ago
- Humans/People from datafile, update people Use data/humans.yaml to generate people section in about and humans.txt. Bumped Geller down a peg :) Rough idea for contributor: 20 odd commits / or under... — committed to newtheatre/history-project by wjdp 7 years ago
Perfect! This ticket can be re-opened with a small edit on the Ticket Title; its no longer specific to the highlight tag
@pathawks I tend to agree with you. Again, I’ll let you guys decide how you want to address it.
On further testing, you can observe this fault any time you use a Liquid tag that must be closed in the first paragraph of your Markdown, and then insert an empty line before the close of the Liquid tag. For example:
Remove the empty lines in the
if
statement, and it builds just fine.@ashmaroli that works for me, and is cleaner than my work around. Thank you.
My use case is that I am making a Jekyll collection of code samples. It may indeed be an edge case, since nobody else has reported the issue yet. I’ll leave it to you guys to decide what to do with it.