Bake your web site with JBake
Bake your web site with JBake
Talk
- Explain what baking a web site is
- Overview of JBake
- Quick Demonstration
Introduction
- Java web developer for CGG
- Creator of JBake
- Adopted Welshman
- Seem to always be involved with CMS's
What is baking a web site?
Building a static web site from just plain old text files ...
... an alternative to a dynamic web site that uses a database.
Benefits
- Performance
- Security
- Platform independence
- Version controlled content
- Use your favourite text editor/IDE
Background
- Project started back in 2013
- Created to 'scratch an itch'
- Inspired by 'Blogging like a hacker' article
Features
- Java (JVM benefits)
- Open source
- Content structure freedom
- Supported content formats...
- AsciiDoc
- Markdown
- Raw HTML
Features
- Blog aware
- Draft publishing support
- Front-end framework freedom...
- Bootstrap
- Foundation
Templates
- Templates enable content reuse
- Provide dynamic nature
- Supported Template engines ...
- Freemarker
- Groovy
- Thymeleaf
- Content data model exposed to templates
Installation
- Download from jbake.org
- Also available through...
- SDKMAN!
- Homebrew
- Maven Central
- Runtime requires just a JRE
Usage Options
- Command line interface...
- init
- bake
- serve
- Maven plugin
- Gradle plugin
- Java API
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
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
<#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>
Config file
site.host=http://jbake.org/
render.tags=false
render.sitemap=true
Time for a quick Demonstration
Alternatives
- Jekyll - Ruby
- Hugo - Go
- Pelican - Python
- Metalsmith - JavaScript