Konsensus Mk I

This program has been phased out, and is no longer in use. This description has been left up for historical purposes. You may perhaps want to visit Konsensus Mk III instead?

Konsensus MkI (“consensus” in English) is the site generator (originally) used to generate this website. Given the input, it outputs a ready directory tree that can be directly copied to a web server and used without further set-up.

Image of the old site

It is written in Ruby, and uses several gems including Redcarpet, Erubis and Rouge.

Why write my own engine? These were the motivations:

  • I know how it works, and know how to alter it to my needs. It is a fairly compact engine, without excessive complexity or piles of abstractions.
  • Blog-aware / there are simple shorthand commands in the schema to declare blog pages, with menus and URLs automatically generated and sorted. Also integrates with Disqus, so comments are easily added.
  • Support for Atom newsfeeds automtically updated upon site updates.
  • Simple, static, uncomplicated, NoScript-safe HTML pages. I do not need a complicated blog system or a live-manageable CMS, so this is a good fit. Menus are JS-free, and pages are mostly usable without JS too; I highly dislike websites which require JS to render anything, even just perfectly static content.
  • Pages are defined using a mixture of Ruby and Markdown. Ruby for the site schema, which allows a ton of flexibility in terms of declaring the site’s structure, and Markdown allows easily writing richly styled content without the syntax getting to the way.
  • Easy-to-use code highlighting, also perfectly static and not dependent on any clientside scripting.
  • Erubis for rendering; the rendering template is provided with the full object of each page, allowing easy and native adaptation to the any special properties of the page. For example, the menu you see on the left is built by Ruby functions included in the page template - isolating the rendering from the actual structure.

Here’s an example from the schema:

# Declare a subscope; a category of pages
subscope do
      # .. all pages in this scope are under the Projects category, unless overriden
      nest_menu(:main_menu, "Projects")

      # Declare a page for Konsensus
      page(url: "projects/konsensus", page_title: "Konsensus", page_description: "Description of the Konsensus project", primary_content: markdown_from_file("md/project_konsensus.md")) do
        # Create a menu item
        nest_menu(:main_menu, "Konsensus", true)


      # Declare a page for Pintograph. Indicate that a table of contents should be printed, and MathJax added
      page(url: "projects/pintograph", page_title: "Pintograph", page_description: "Description of the Pintograph project", primary_content: markdown_from_file("md/project_pintograph.md"), page_properties: {:render_toc => true, :requires_mathjax => true}) do
        nest_menu(:main_menu, "Pintograph", true)

      # Create a project front page. Indicate that a table of contents should be printed.
      page(url: "projects", page_title: "Projects", page_description: "A listing of projects", primary_content: markdown_from_file("md/projects.md"), page_properties: {:render_toc => true}) do
        # Flag this page as the primary option; the menu has been already declared in the enclosing scope
        # Set this as a item on the top bar
        set_menu(:topbar, "PROJECTS", true)
# Declare a blog page
blog_article(29,5,2017, "Solving Boggle with Haskell", "A small code-along to find words from a NxN grid", markdown_from_file("md/blog2017/boggle-29052017.md"), {:render_toc => true, :show_disqus => true})

From autumn 2018, this version of the program was no longer in use. The engine has been rewritten from ground up in Golang, and is now known as Konsensus Mk II.

© Arttu Ylä-Sahra 2016-2022
Page rendered on 2022-03-25T15:05:50.587+00:00
Privacy statement