Adding Jekyll to an existing website - jekyll

I have a simple website and tried to add a Jekyll blog in it in a new folder blog thus I have run jekyll new blog in the folder /path. However when I'm running the command jekyll build in /path I have these errors:
$ jekyll build
Configuration file: none
Source: /path
Destination: /path/_site
Generating...
Build Warning: Layout 'post' requested in blog/_posts/2015-06-14-welcome-to-jekyll.markdown does not exist.
Build Warning: Layout 'default' requested in blog/index.html does not exist.
Conversion error: Jekyll::Converters::Scss encountered an error converting 'blog/css/main.scss'.
Conversion error: File to import not found or unreadable: /blog/_sass/base.scss. Load paths: on line 47
I solved the first problem (Configuration file: none) by moving _config.ymlin the parent folder, however I still have problems when requesting layout using
---
layout: default
---
The imports in main.scssare also not working (last error).
If I'm doing the same command jekyll build in /path/blogafter moving again _config.yml, I have no errors. Does someone know how to be able to do a jekyll buildin the parent folder with the configuration I have? Do I have to entirely change the architecture of my website to include a Jekyll blog in it?

You config.yml is in /path with
source: /_jekyll
destination: /blog
baseurl: /blog
Your jekyll sources are in /path/_jekyll.
And you generated files will be in /path/blog.
Ready to deploy !

Related

How do I redirect an old Netlify + Jekyll site address, to the new address?

I created a Jekyll site, hosted at Netlify, at old.address.com. Now I want to redirect to new.address.com. But the Netlify docs doesn't seem to work or I don't understand the docs. This is what I did:
I added, to _config.yml: (because Netlify says Jekyll excludes '_...' files)
include:
- _redirects
And I added a _redirects file. I just copy-pasted Netlify's generated instructions into that file, this is the content:
# Redirect domain aliases to primary domain
https://jekyll-comments.demo.ed.community/* https://jekyll-demo.talkyard.io/:splat 301!
http://jekyll-comments.demo.ed.community/* https://jekyll-demo.talkyard.io/:splat 301!
https://jekyll.demo.talkyard.io/* https://jekyll-demo.talkyard.io/:splat 301!
http://jekyll.demo.talkyard.io/* https://jekyll-demo.talkyard.io/:splat 301!
And this has no effect. What's the problem / what am I doing wrong?
This is how the directory looks like:
$ ls -1
404.html
about.md
_config.yml
Gemfile
_includes
index.md
_layouts
_posts
_redirects <—— added as per Netlify's instructions
_sass
_site
$ ls -1 _posts/
2018-01-01-like-about-jekyll.markdown
2018-01-02-installation-instructions.markdown
2018-01-02-kind-creatures.markdown
The config file is just the default one:
title: ...
email: ...
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
twitter_username: ...
github_username: ...
# Build settings
markdown: kramdown
theme: minima
plugins:
- jekyll-feed
talkyard_comments_server_url: ...
include:
- _redirects
Please note that although there are fairly many details above, it's all just various default stuff. So it's not specific to my problem. It should apply to all new Jekyll sites.
Disclaimer: I work for Netlify
We have a specific section on this in our documentation: https://www.netlify.com/docs/redirects/#handling-hostnames-and-protocols-differently
...and your snippet should work since it follows those conventions.
The only prerequisites to make that work are:
1) that you have your site configured in our UI to answer to ALL of those names - so:
jekyll-comments.demo.ed.community
jekyll-demo.talkyard.io
jekyll.demo.talkyard.io
2) and that all names are set up the same in DNS (CNAME to yournetlifysitename.netlify.com)
The only way to add "extra" names to your Netlify configuration is as domain aliases, which are configured in the Domain settings panel right next to your "main" custom domain.
Since your _redirects looks correct to me, if you have the prerequisites configured as suggested, the most likely failure mode is that you don't end up with your redirects actually applied for some reason (usually - they didn't get deployed because they didn't exist in a file called _redirects, in your publish folder, after the build), but your include in the jekyll config should allow that file to persist in that location. That jekyll config is the "right" way to do it but for other site generators, we sometimes advise people to copy the redirects into place after build: jekyll build && cp netlify_redirects.txt _site/_redirects
You can download whatever files are in your deploy to examine their "final state" via this tiny icon from any successful deploy logs page:
From a quick look at your site configuration, they appear to be deployed and working:
$ curl -v https://jekyll-comments.demo.ed.community/ -o /dev/null
* Connected to jekyll-comments.demo.ed.community (35.199.180.1) port 443 (#0)
[...]
< HTTP/1.1 301 Moved Permanently
[...]
< Location: https://jekyll-demo.talkyard.io/
So I guess the next question is...how are you testing?

Jekyll not finding blog posts

Source Code
I am new to Jekyll and got it installed with Grunt and SASS. My issues is that while my test site will show my new posts, When I click on the post link I get an error "Cannot GET /blog/example-post-name".
Grunt doesn't show any errors when running Grunt Serve. However if I run Jekyll serve I get the following errors:
Build Warning: Layout 'article' requested in app/_posts/2015-01-31-optimized-jekyll-site-with-grunt.markdown does not exist.
Build Warning: Layout 'article' requested in app/_posts/2017-03-20-welcome-to-jekyll.markdown does not exist.
Liquid Exception: Could not locate the included file 'blog.html' in any of ["/Users/rich/jekyll-site/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in app/index.html
jekyll 3.4.2 | Error: Could not locate the included file 'blog.html' in any of ["/Users/rich/jekyll-site/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source.
It appears that it cannot find anything in my: _includes, _layouts, ect... folders.
Any help would be appreciated.
Since your template files are in the app/ directory, simply build with app as the source directory.
Add the following to your _config.yml:
source: app
Then run jekyll serve as usual.
Try adding blog.html file in _includes folder or use layout: default in your posts 2015-01-31-optimized-jekyll-site-with-grunt.markdown etc.

travis-ci : error during the build (No such file or directory)

I'm having a problem trying to test my build on travis-ci for my jekyll app. One of the plugins generates a json containing informations that my app can reach for a search tool.
The build command works fine on my computer :
bundle exec jekyll build --source octopress
Witch indexes informations into a search.json file in my built directory (_site).
But it fails on travis-ci as on Heroku.
writting search.json to /home/travis/build/alain-andre/mon_site/_site
jekyll 2.5.3 | Error: No such file or directory - /home/travis/build/alain-andre/mon_site/_site/search.json
Can anyone help ?
OK, I found the solution.
I had to add the search.json into the jekyll site.keep_files.
First to do is to create a Jekyll::StaticFile inside your Jekyll module.
class SearchJson < Jekyll::StaticFile
def write(dest)
begin
super(dest)
rescue
end
true
end
end
Then, when your file is created, add it to site.static_files like this :
# Keep the file from being cleaned by Jekyll
Jekyll::SearchJson.new(site, site.dest, "/", filename)
site.keep_files << filename

jekyll 3.0.0-beta error Is a directory # rb_sysopen

With jekyll-2.5.3 I'm able to run "jekyll serve --watch" to generate my site and preview it. However, since upgrading to jekyll-3.0.0.pre.beta1 I now see the following error
jekyll serve --watch
Configuration file: /wrk/git/blog/_config.yml
Deprecation: Auto-regeneration can no longer be set from your configuration file(s). Use the --[no-]watch/-w command-line option instead.
Deprecation: The 'pygments' configuration option has been renamed to 'highlighter'. Please update your config file accordingly. The allowed values are 'rouge', 'pygments' or null.
Source: /wrk/git/blog
Destination: /wrk/git/blog/_site
Incremental build: enabled
Generating...
Build Warning: Layout 'nil' requested in atom.xml does not exist.
Build Warning: Layout 'nil' requested in rss.xml does not exist.
jekyll 3.0.0-beta1 | Error: Is a directory # rb_sysopen - /wrk/git/blog/_site/tech/2013/04/24/blog
I've checked and I have read/write/execute permissions, so I don't think it's a permission error. If it helps, here's my source and layout (https://github.com/minhongrails/blog), which has directories like _includes, _layouts, _posts, index.html, etc in the root directory.
Does anyone have any ideas how to resolve this? Thanks!
Build Warning: Layout 'nil' requested in atom.xml does not exist.
Build Warning: Layout 'nil' requested in rss.xml does not exist.
I think the layout should be null, not nill.
For some reason I needed to move my source files into a "source" subdirectory as specified in the _config.yml. Here's some of the _config.yml that I had to modify
source: src
# needed to also update this b/c it was generating inside the "source" dir
destination: _site
In Jekyll 2 I didn't need to do this but I guess it's now necessary in Jekyll 3? Here's a Github issue with more details: https://github.com/jekyll/jekyll/issues/3248

Unable to generate anything with Jekyll

When I run Jekyll it does not generate anything. The output I see:
Configuration from /home/mbsheikh/techtraits/techtraits-blog/_config.yml
Auto-regenerating enabled: /home/mbsheikh/techtraits/techtraits-blog -> /home/mbsheikh/techtraits/techtraits-blog/_site
[2012-06-15 23:23:03] regeneration: 118 files changed
The _site directory is empty. Is there a way to debug Jekyll? I changed a couple of files and still don't see anything in _site.
Set auto=false in the_config.yml, then run jekyll again, then you will see the ruby error trace info.