Tags

By year

  1. 2019 (1)
  2. 2018 (2)
  3. 2017 (4)
  4. 2015 (9)

Starting a Blog with Middleman

Ruby Middleman

Posted on Jun 3


Blogging with a static site generator seemed easy to me, but there were a couple of steps just to start blogging. I selected Middleman as the blogging framework and wrote rough notes below of the steps required to generate this page. The following procedures are of course very specific to this site.

Getting middleman-blog-bootstrap-template

mkdir ~/.middleman
git clone https://github.com/biblichor/middleman-blog-bootstrap-template.git ~/.middleman/blog-bootstrap

Making a Fresh Blog Project

The option --template=blog-bootstrap of middleman init is specified to use the template. Node.js and Bower are also required to run bower install.

mkdir my-gh-pages
middleman init --template=blog-bootstrap
bower install
bundle exec middleman server

By accessing port 4567 (by default) with the web browser, we can see how the pages are generated. Thanks to the nice template by biblichor, they look pretty good without any tuning.

Creating a New Article

bundle exec middleman article "TITLE"

MathJax

The following single line inserted in the source/layouts/layout.slim file enables rendering of math.

    = javascript_include_tag "//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"

Example:

\[ {F_n} = \frac{({1 + \sqrt{5}})^n - ({1 - \sqrt{5}})^n}{{2^n}\sqrt{5}} \]

Marking an Article as Draft

Articles marked as draft by turning off published flag in frontmatter will not be published. The contents of draft articles can still be checked by accessing the preview server (middleman server) and they are not deployed with middleman deploy. After checking has been done, the finished works are deployed by removing published false from the frontmatter and calling middleman deploy.

---
title: <title>
published: false
---

References


2015 My gh-pages