ERQX is an embeddable blog engine for Play Framework.
I wrote it to host my own blog, so currently it has the minimum feature set that I needed.
Currently it supports one backend - git.
- Can be easily embedded into any Play application via a module include in the routes file.
- Git backend with directory layout similar to Jekyll, YAML front matter on blog posts, etc.
- Instant deploy from git hosting provided via commit hooks.
- Supports Markdown and HTML.
- Markdown blog posts may include code snippets from files external files - this allows embedding code snippets that are compiled and/or tested.
- Can host multiple blogs.
- Completely themeable.
- Default theme uses responsive layout and Disqus for comments.
- Support for many common blog features including tags, archive navigation, ATOM feeds.
- Renderable static pages.
- Heavy use of caching.
- prismic.io backend.
- Virtual hosting.
- Pluggable blog post formats.
- Multiple language support.
-
If you don't have an existing Play project that you want to embed it into, create a new one.
-
Add the following to your
build.sbtfile:resolvers += Resolver.bintrayRepo("jroper", "maven") libraryDependencies += "au.id.jazzy.erqx" %% "erqx-engine" % "2.1.2" -
Add a route to the blog router to your
conf/routesfile:-> / au.id.jazzy.erqx.engine.controllers.BlogsRouter -
Add the following configuration to your
application.conf:# The blogs blogs { # A blog with name default. The name can be anything, it is only used internally. default { # The path of the blog. This should not end in a slash. This path will be relative to the path that the blogs # router is deployed to. path = "/blog" # The order that the blog is routed. Important if you have blogs that are nested in other blogs paths. # Defaults to 10. # order = 10 # The git configuration gitConfig { # The repo must be a repo on the filesystem that has been cloned from somewhere. gitRepo = "/path/to/some/repo" # The path within the repo to serve the blog from. Optional. # path = "blog/" # The branch to read the blog from. Defaults to published. # branch = "published" # The name of the remote to fetch from. If not specified, no fetch will be done when updating. # remote = "origin" # The fetch key. Used to authenticate commit hooks from a remote git repository such as GitHub. # If not specified, remote triggering of fetching is disabled. # fetchKey = "somesecret" # The update interval. If specified, the blog will be fetched (if a remote is configured) and reindexed at this # interval. Reindexing is only done if the blog has actually changed. updateInterval = 10 minutes } } }
Now you're good to go!
You can place posts into a _posts directory in the repo, all posts will be picked up from there. Blog posts should have a name in the format year-month-day-permalink-title.format, for example, 2013-11-23-my-first-post.md. Allowed formats are md and html.
Similarly, you can also place static pages into a _pages directory in the repo, and all pages will be picked up from there.
A file called _config.yml should be placed in the root directory of the repo.
Anything found in the root directory that doesn't start with an underscore will be served as a static asset, so images, for example, can be placed anywhere in the repo.
The config file contains the main properties for the blog post. For example:
# The title
title: My blog
# Optional subtitle
# subTitle: Just another ERQX blog
# Author - used by atom feed
author: Someone
# The description - optional, may contain HTML.
description: |
This is the description of the blog. It can contain HTML, such as:
<ul style="text-align: left">
<li>Lists
<li>Images
<li>Anything else
</ul>
# The footer - optional, may contain HTML.
footer: |
Copyright Someone. All rights reserved.
# The theme to use, if not specified uses the default theme.
# theme: au.id.jazzy.erqx.engine.models.DefaultTheme$
# The timezone to use for all parsed dates. Defaults to system
# timezone if not specified.
# timezone: Canberra/Australia
# Other arbitrary properties may go here that may be used by the theme.
# The default theme allows specifying a disqus id:
# disqus_shortname: mydisqusblog