Can I change Jekyll's temp directory? - jekyll

Can I change the directory Jekyll uses for it's temporary building?
I'm using Jekyll on a gh-pages branch and when I switch back to my Ember project on master, it puts new files in /tmp. This causes problems with Jekyll's build, and forces me to delete the dir each time I switch back to gh-pages.

Yes, you can.
You have a few ways of doing this, in your local folder, where _config.yml is located (Jekyll site root directory):
A. Editing _config.yml to have a destination for site generation:
In _config.yml, add the following:
destination: /tmp/jekyll_site/
This will tell jekyll you want temporary sites generated in the /tmp/jekyll_site folder.
B. Passing the destination via terminal
jekyll serve -d /tmp/jekyll_site/
OR jekyll serve -destination /tmp/jekyll_site/
This flag will have Jekyll generate files in the specified folder.
More information on the configuration options and flags used by Jekyll can be found here in the documentation. :)

Related

Is there an easy way to make Jekyll output files to a docs/ directory?

I'm using Jekyll to build a Github pages site, and have run into a sort of silly issue.
Github recommends Jekyll for Github pages, so I sort of assumed it would just work; however, it does not.
Jekyll by default builds all files to the _site/ directory, which is really nice and looks fancy and so on, but is not an option for Github pages.
Github seems to offer only three options for hosting:
Root of master Branch
docs/ Folder of Master Branch
gh-pages Branch
So, pray tell, why can I not build Jekyll to either A. a branch with a custom name or B. a folder named docs/ instead of _site?
Turns out I didn't read enough docs.
The solution is to add a tag to the _config.yaml file in the root of the project.
This line will switch from using _site to docs/ for build output:
destination: docs/
Alternately, you can pass this as an environmental variable like so:
jekyll build --destination docs/

How to prevent CNAME file from getting dropped during Jekyll build process

I'm using Jekyll with Forestry.io and GitHub Pages. Everything seems to be working properly except for when the build process runs and the site is copied to the gh-pages branch. All of the static files (eg. robots.txt and sitemap.xml) get copied, but the CNAME file for my custom domain does not.
If I change the file name to all lowercase (cname) then it gets copied. But GitHub Pages doesn't recognize a cname file.
I don't think anything in the build portion of the Forestry.io settings would cause this issue.
build:
preview_command: bundle exec jekyll build --drafts --unpublished --future -d _site
publish_command: bundle exec jekyll build -d _site
preview_env:
- JEKYLL_ENV=staging
publish_env:
- JEKYLL_ENV=production
preview_output_directory: _site
output_directory: _site
Are you publishing your build to Github Pages? Github Pages can/should contain the (Jekyll) source, not the build. So to be extra clear: Github Pages should contain .md files and not (built) .html files. The CNAME file is designed to be used by Github Pages, so Github Pages is not the culprit. Forestry.io or your build process probably is. Forget about the build process and publish your changes directly to your github pages branch. That should do the trick.

Jekyll Website won't load

I've been trying for a while to get a Jekyll website running on Github Pages, but it doesn't seem to work. I've been getting the error
Your site is having problems building: The symbolic link
/vendor/bundle/ruby/2.3.0/gems/ffi-1.9.18/ext/ffi_c/libffi-x86_64-linux-gnu/include/ffitarget.h
targets a file which does not exist within your site's repository. For
more information, see
https://help.github.com/articles/page-build-failed-symlink-does-not-exist-within-your-site-s-repository/.
I have already tried it with 9 different Jekyll themes, but none of them seem to work, so I'm clearly doing something wrong. Here are the steps that I am taking
1) Create a new repo and put the files from a Jekyll Theme there, OR fork it from another repo (e.g. https://github.com/iwiedenm/jekyll-theme-massively-src)
2) Git pull it into my computer and make sure I'm on the gh-pages branch
3) Run bundle install --path vendor/bundle
4) Make sure it was built with bundle exec jekyll serve
5) Once it looks good, upload it into Github
git add *
git commit -m 'Test'
git push
Then I go to the repo in the browser and I see the error above, and I can't see the website because of that missing "ffitarget.h" file. When I go look for it in that directory, I am able to find it, but Github doesn't seem to be able to find it.
Nick Shu
PS: Feel free to mark this as a duplicate. I have seen other pages, such as this and I tried it, but it didn't work.
Github page will use local gems in vendor. If you commit them, you will have errors each time github pages tries to resolve symbolic links.
From a fresh repository
Add vendor/** in your .gitignore file before you do a git add . *.
The dot in git add . * forces git to stage dotfiles (.gitignore, ...).
From an already existing repository containing gems in a vendor folder
Add vendor/** in your .gitignore file,
Remove vendor/ files from versioning, git rm --cached -r vendor/
You can now stage, commit and push
git add . *
git commit -m 'remove vendor from versioning'
git push origin master`
Notes :
you can publish master branch content, as gh-pages branch is no more mandatory. See documentation.
unless you have special needs like debuging, it's not necessary to download gems for each of your project. You can just do a bundle install.
Ensure the vendor/bundle/ directory has been excluded..
By default, Jekyll excludes that directory and therefore, it would not care about the contents in your vendor directory..
When you fork/clone a repo, there's a possibility that the exclude: list has been customized (therefore overriding the default setting). You can ensure vendor/bundle/ is ignored by Jekyll by adding it to your custom exclude list:
# Exclude list
exclude:
- README.md
- Gemfile
- Gemfile.lock
- node_modules
- gulpfile.js
- package.json
- _site
- src
- vendor
- CNAME
- LICENSE
- Rakefile
- old
- vendor/bundle/
To locally emulate how the site is built on GitHub Pages, you can build using the --safe switch:
bundle exec jekyll serve --safe

Jekyll copying md files instead of processing them

I have a directory full of markdown (.md) files I want to render into a website so I can see what it will look like. I installed Jekyll which I've used a number of times, cd'd into the directory and executed Jekyll serve.
Jekyll created the _site directory and instead of processing my .md files into .html files, it just copied them into the _site directory.
I'm at a bit of a loss as to why it's not processing the markdown. Anyone know why?
Jekyll only processes files with Front Matter.. otherwise, those files are designated as "static files" and simply copied verbatim to the destination directory.

how to setup octopress if you already have one in github?

this is my blog hosted in github.
http://john-qin.github.io/
now, i want to setup octopress on my ubuntu 12.04. I followed the instruction on this page.
http://octopress.org/docs/deploying/github/
I got stuck after "rake setup_github_pages". this instruction is for setting up brand new environment for octopress. I already have it in github. how do I pull the existing one? and where should I put them?
Octopress repositories have two branches, source and master. The source branch contains the files that are used to generate the blog and the master contains the blog itself.
When the local folders are initially configured according to the Octopress Setup Guide, the master branch is stored in a subfolder named _deploy. Since the folder name begins with an underscore, it is ignored when you git push origin source. Instead, the master branch (which contains your blog posts) gets updated when you rake deploy.
To recreate the local directory structure of an existing Octopress blog, follow these instructions.
First you need to clone the source branch to the local octopress folder.
git clone -b source git#github.com:username/username.github.com.git octopress
Then clone the master branch to the _deploy subfolder.
cd octopress
git clone git#github.com:username/username.github.com.git _deploy
Then run the rake installation to configure everything
gem install bundler
rbenv rehash # If you use rbenv, rehash to be able to run the bundle command
bundle install
rake setup_github_pages
It will prompt you for your repository URL. Enter the read/write url for your repository
(For example, 'git#github.com:your_username/your_username.github.com)
You now have a new local copy of your Octopress blog. Check out this post for more information.