I just created a great gallery for my Jekyll blog which builds perfectly on my localhost:4000. However, GitHub pages doesn't support the Jekyll Gallery Generator plug-in I am using: https://github.com/ggreer/jekyll-gallery-generator
I read about the alternative method of hosting Jekyll on a traditional host using FTP (uploading the _site directory) http://jekyllrb.com/docs/deployment-methods/ However, rather than reconfigure my entire site and hosting, It would be great if GitHub Pages could be used somehow even though I'm using a non-supported plugin.
What is a workaround for this?
So it turns out the answer is that you can use jekyll source code, but only if it's in the gh-pages branch. If you use the docs/ folder or the master branch, it seems that you need to build locally before pushing (these options just allow you to host compiled HTML files rather than the raw jekyll source files).
Depending if you deal with a User/Organization (UO) site or a Project site (P), do :
git init
git remote add origin [email protected]:userName/userName.github.io.git
(UO) or git remote add origin [email protected]:userName/repositoryName.git
(P)jekyll new .
creates your code basebaseurl: ''
(UO) or baseurl: '/repositoryName'
(P)jekyll build
will create the destination folder and build site.git checkout -b sources
(UO) or git checkout master
(P)git add -A
git commit -m "jekyll base sources"
commit your source codegit push origin sources
(UO) or git push origin master
(P) push your sources in the appropriate branchcd _site
touch .nojekyll
, this file tells gh-pages that there is no need to buildgit init
init the repositorygit remote add origin [email protected]:userName/userName.github.io.git
(UO) or git remote add origin [email protected]:userName/repositoryName.git
(P)git checkout master
(UO) or git checkout -b gh-pages
(P) put this repository on the appropriate branchgit add -A
git commit -m "jekyll first build"
commit your site codegit push origin master
(UO) or git push origin gh-pages
(P)You now have something like Octopress does. Look at their rake file, there are some nice comments inside.
Better way is to configure Travis to automate deployment of jekyll with non-supported plugins. Follow Travis getting started guide to enable Travis for your repo.
Create script/cibuild
with the following content
#!/usr/bin/env bash set -e # halt script on error bundle exec jekyll build touch ./_site/.nojekyll # this file tells gh-pages that there is no need to build
Create .travis.yml
with the following content (modify as required)
language: ruby rvm: - 2.3.3 before_script: - chmod +x ./script/cibuild # or do this locally and commit # Assume bundler is being used, therefore # the `install` step will run `bundle install` by default. script: ./script/cibuild # branch whitelist, only for GitHub Pages branches: only: - master env: global: - NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer sudo: false # route your build to the container-based infrastructure for a faster build deploy: provider: pages skip_cleanup: true keep-history: true local_dir: _site/ # deploy this directory containing final build github_token: $GITHUB_API_KEY # Set in travis-ci.org dashboard on: branch: master
Deployment steps (after every push):
script/cibuild
in _site
directory_site
will be pushed to gh-pages
branch..nojekyll
file)Reference: My repository https://github.com/armujahid/armujahid.me/ is using this method for continuous integration using Travis CI
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With