Skip to content

CoderDojoZH/coderdojozh-jekyll-2019

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jekyll for CoderDojo Zürich

Installing Jekyll for Github pages as a local project on Linux

Install Ruby as needed by Jekyll:

$ sudo apt-get install ruby-full build-essential zlib1g-dev

Get gem – the Ruby package manager – to install the packages into your home (no sudo needed) by adding to your ~/.bashrc file:

# Install Ruby Gems to ~/gems
export GEM_HOME="$HOME/gems"
export PATH="$HOME/gems/bin:$PATH"

Read your new .bashrc file:

source ~/.bashrc

Install bundler, which will install gems locally to your project:

$ gem install bundler

In your project's directory, create a Gemfile

source 'https://rubygems.org'
gem 'github-pages', group: :jekyll_plugins

Install Jekyll in your project's directory:

$ bundle install --path vendor/bundle

Creating the the scaffold

$ bundle exec jekyll new --force --skip-bundle .

Edit the Gemfile that has been created to get the same Jekyll version as installed on Github (instead of the current version):

  • remove the line $"jekyll", "3.3.0"
  • uncomment the line gem "github-pages", group: :jekyll_plugins
  • run bundle install

Running locally

$ bundle exec jekyll serve

Updating the gems

$ bundle update

English and german

  • Create each page as a md file in each language and with different names.
  • copy the theme (in the default install it's in the minima gem) _include/header.html and adjust the pages loop to:
{% assign pages=site.pages | where:"lang", page.lang %}
{% for my_page in pages %}
{% endfor %}

After the end the the <header> add the list of the languages:

<div class="wrapper" style="text-align: right; line-height: 2em">
  {% assign pages=site.pages | where:"ref", page.ref | sort: 'lang' %}
  {% for page in pages %} <a href="{{ page.url | prepend: site.baseurl }}" class="{{ page.lang }}">{{ page.lang }}</a> {% endfor %}
</div>

Tweaking the css

Add a assets/main.scss file with the content:

---
---

@import "{{ site.theme }}";

You can then add custom css directives after the import line.

Warning: in order to know which file you have to create, you should have a look at the _site/assets/ directory and the main css file (currently _site/assets/main.css).

Pushing to Github (pages)

  • If the page is for a repository, we need to set the name of the repository as the "baseurl" in the _config.yml file.

Pages

Notes

Plugins: plugins do not work for gh-pages anyway

Inspiration:

Resources