jekyll: Jekyll cannot Find my _layouts when I use --config and -s command line args
- 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 ran
jekyll doctor
to check my configuration - 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 am on (or have tested on) Other FreeBSD
- 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
First of all, if I lock my jekyll version to 2.4.0, the site builds perfectly fine.
I use a git hook to build my site automatically
REPO="$HOME/git/landing-page.git"
TMP="$HOME/tmp/landing-page"
CONFIG="$TMP/_config.yml"
DEST="$HOME/sites/landing-page"
echo "Cloning..."
git clone $REPO $TMP
echo "Installing gems and building..."
cd $TMP && bundle install
echo "Building..."
bundle exec jekyll build --config $CONFIG -s $TMP -d $DEST
echo "Cleaning up..."
rm -rf $TMP
Which yields me this error:
Configuration file: /home/freebsd/tmp/landing-page/_config.yml
Source: /home/freebsd/tmp/landing-page
Destination: /home/freebsd/sites/landing-page
Incremental build: disabled. Enable with --incremental
Generating...
Error reading file /usr/home/freebsd/tmp/landing-page/_layouts/compress.html: No such file or directory @ rb_sysopen - /home/freebsd/tmp/landing-page/usr/home/freebsd/tmp/landing-page/_layouts/compress.html
Error reading file /usr/home/freebsd/tmp/landing-page/_layouts/master.html: No such file or directory @ rb_sysopen - /home/freebsd/tmp/landing-page/usr/home/freebsd/tmp/landing-page/_layouts/master.html
done in 0.717 seconds.
Auto-regeneration: disabled. Use --watch to enable.
<strike>Those _layouts do exist, and the paths are correct, but jekyll says it can’t read them, but only on the latest jekyll. Version 2.4.0 works fine.</strike>
Actually, the path looks like it’s getting messed up at some point in jekyll
If I change the hook script to this, it builds correctly even on the latest jekyll:
REPO="$HOME/git/landing-page.git"
TMP="$HOME/tmp/landing-page"
CONFIG="$TMP/_config.yml"
DEST="$HOME/sites/landing-page"
echo "Cloning..."
git clone $REPO $TMP
echo "Installing gems and building..."
cd $TMP && bundle install && bundle exec jekyll build -d $DEST
echo "Cleaning up..."
rm -rf $TMP
So it seems something goes wrong with the paths within jekyll when you specify config and source command line args
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 26 (13 by maintainers)
Played around with the new branch a bit and figured out it works when I run the script directly instead of through a hook. Tested before and after the custom branch and the branch fixes the template path issue.
Edit your Gemfile like below: