Static site generation on the JVM with JBake

Talk

Introduction

What is baking?

Building a static web site from simple text files ...

... a popular alternative to frying a web site using a database.

So why bake?

Benefits

On to JBake

Background

...just a hobby, won't be big and professional...

Features

Features

Templates

Installation

Usage Options

Example sites

How it works

How the "oven" works

Site/Project layout

	├── assets
	│   ├── css
	│   ├── img
	│   └── js
	├── content
	│   ├── changelog.md
	│   ├── news
	│   │   ├── index.md
	│   │   └── jbake-v2-1-released.md
	│   └── sites.md
	├── templates
	│   ├── index.ftl
	│   ├── page.ftl
	│   └── post.ftl
	└── jbake.properties
	

Content file - Markdown


title=Changelog
date=2013-03-30
type=page
status=published
~~~~~~

### v2.1

*2013-04-30*

* Added unit tests
* Added post baking stats
* Command line arguments are now optional
...

Template file - Freemarker


  <#include "header.ftl">
  
  <#include "menu.ftl">

  <div class="page-header">
    <h1>Blog</h1>
  </div>
    <#list posts as post>
      <#if (post.status == "published")>
        <a href="${post.uri}"><h1>
          <#escape x as x?xml>${post.title}</#escape>
        </h1></a>
        <p>${post.date?string("dd MMMM yyyy")}</p>
        <p>${post.body}</p>
      </#if>
    </#list>

Template file - Jade


 doctype html
 html
  include header.jade
  body(onload="prettyPrint()")
    div#wrap
      include menu.jade
        div.page-header
          h1 Blog
          each post in published_posts
            a(href="#{post.uri}")
              h1 #{post.title}
            p #{formatter.format(post.date,
            		"dd MMMM yyyy")}
            p !{post.body}

Config file


  site.host=http://jbake.org
  render.tags=false
  render.sitemap=true
  template.masterindex.file=index.jade
  template.archive.file=archive.jade
  template.tag.file=tags.jade
  template.sitemap.file=sitemap.jade
  template.post.file=post.jade
  template.page.file=page.jade
  template.feed.file=feed.jade

Time for the Demonstration

Further Reading

Thanks any questions..?