Up And Running
I thought I’d catalog the steps that I used to create this site as it’s first post.
Short description
- Install git (not covered in the article)
- Install cURL (not covered in the article)
- Installed anyenv
- Installed rbenv
- Installed ruby
- Installed Bundler
- Installed Octopress (which installs Jeyll)
- Installed the generate_categories Jekyll plugin
- Deployed to GitHub Pages for the Bounded Infinity account.
The Details
Installing anyenv:
git clone https://github.com/riywo/anyenv ~/.bash_profile
echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(anyenv init -)"' >> ~/.bash_profile
exec $SHELL -l
Installing rbenv:
anyenv install rbenv
exec $SHELL -l
Installing ruby:
rbenv install 2.2.0
exec $SHELL -l
rbenv shell 2.2.0
Installing Bundler:
gem install bundle
rbenv rehash
Installing Octopress:
gem install octopress
rbenv rehash
Initializing the site:
octopress new blog
At this point the site should be functional, test it like so:
cd blog
jekyll serve
Then open a browser and view the site at http://localhost:4000.
If you see a web page, then everything up to this point hash worked correctly.
I added a few extras to make it easier to check this site out in a different location, but adding a .ruby-version to automatically manage the ruby version via rbenv, and to manage the sites dependencies through Bundler.
For rbenv:
echo 2.2.0 > .ruby-version
Then for Bundler:
echo "gem 'octopress', '~> 3.0'" > Gemfile
This is a good time to save your initial site.
git add .
git commit -m "initial octopress generated site"
I decided to keep this blog’s source code in a private repository, so I create one, added the remote and push code. To test that the site worked, I cloned the http://boundedinfinity.github.io site and added the following to _config.yml:
destination: ../boundedinfinity.github.io
Next, I cloned the site:
cd ..
git clone https://github.com/boundedinfinity/boundedinfinity.github.io
Then I built the site, created a minimal .gitignore file, and pushed:
cd blog
jekyll build
cd ../boundedinfinity.github.io
echo Gemfile
echo Gemfile.lock
git add .
git commit -m "initial site"
git push origin master
Next test out the live site, by browseing to http://boundedinfinity.github.io/.
I wanted the following features:
After some research I installed and configured a (slightly modified) generate_categories Jekyll plugin.
I installed the plugin by:
cd ../blog
curl https://raw.githubusercontent.com/recurser/jekyll-plugins/master/generate_categories.rb > _plugins/generate_categories.rb
curl https://raw.githubusercontent.com/recurser/jekyll-plugins/master/_layouts/category_index.html > _layouts/category_index.html
I added the following to _layouts/post.html:
<div class="categories">Filed under: {{ page.categories | category_links }}</div>
I then added the following to index.html:
<h1 class="page-heading">Categories</h1>
{% raw %}
<ul>
{% for cat in site.categories %}
<li><a href="/categories/{{ cat[0] }}/index.html">{{ cat[0] }}</a></li>
{% endfor %}
</ul>
{% endraw %}
cat[0]
in the code
above I found in the For loops section of the
Liquid for Designers
guide.I then commented out the following line in the _plugins/generate_categories.rb file:
self.data['title'] = "#{title_prefix}#{category}"
To enabled the GitHub Flavored Markdown I changed the markdown renderer from the default kramdown to redcarpet. I changed the _config.yml from:
markdown: kramdown
to:
markdown: redcarpet
Then finally, I update the site wide configuration in _config.yml (title, email, description, etc…) and tweeked a few things in the templates that I didn’t like, and pushed it to the live site.
Even though I have had some experience with all these tools (and built a page or two here and there with Jeyll and Octopress), it probably took me 5 or 6 hours over a couple of days to figure everything out.