Jekyll Howtos for this site




Adding a new collection in Jekyll

Step 1: Add a new entry to collections site configuration

Under collections in the _config.yml file, add the new collection, e.g. ‘jekyll’

collections:
    git:
        permalink: /:collection/:name
        output: true
    javascript:
        permalink: /:collection/:name
        output: true
    jekyll:
        permalink: /:collection/:name
        output: true

Step 2: Create a new subdirectory in the root of the site

In this example _jekyll:

f0a273a759d73b1f6127b5d2add6a2b3

Step 3: Update search configuration

Next add a configuration for the search engine. In the file, /js/search-content.js, before the final curly brace - { - add a new stanza, making sure to MOVE the following line

{% unless forloop.last %},{% endunless %}

from the now 2nd last stanza to the newly inserted one, REPLACING the moved line with a comma

e.g.

// collection jekyll
{% for item in site.jekyll %}
"{{ item.url | slugify }}": {
    "title": "{{ item.title | xml_escape }}",
        "author": "{{ item.author | xml_escape }}",
        "category": "{{ item.category | xml_escape }}",
        "content": {{ item.content | strip_html | jsonify }},
    "url": "{{ item.url | xml_escape }}"
}
{% unless forloop.last %},{% endunless %}
{% endfor %}

 


 

Serving a Github-Pages (Jekyllrb) locally

First git clone the code for the site from Github and define the location of the files in the variable GITHUB_LOCATION.

Then generate the necessary scaffold:

mkdir jekyll_tmp
cd jekyll_tmp
jekyll new --skip-bundle .
mv -i Gemfile $GITHUB_LOCATION
rm -rf jekyll_tmp
cd $GITHUB_LOCATION

Configure the site as per these instructions,

making sure that the lines starting

Then add files to .gitignore

cd $GITHUB_LOCATION
for i in {Gemfile{,.lock},_site/}; do echo $i | tee -a .gitignore2; done
git add .gitignore && git commit -m'ignore files needed for local serving'

and create the site:

bundle install # takes a while

To serve the site locally (usually on port 4000):

bundle exec jekyll serve --livereload

 


 

Jekyll references and resources

Main Jekyll source site

Liquid