obelisk ======= Static Site Generator written in Elixir. [](https://travis-ci.org/BennyHallett/obelisk) [](https://hex.pm/packages/obelisk) ## Goals * **Fast**. Static websites can take a long time to generate when they start to grow large. obelisk should take advantage of Elixir's processes to increase this speed. * **Simple, Obvious**. It should be very straight forward to add new content and modify the way that your site works. * **Templatable**. It should be possible to store templates in github repos and reference them directly, allowing modification of the look and feel of a site instantaneously with no manual installation. ## Creating a new obelisk project To create a new obelisk project, we use `mix` $ mix new blog We then modify our dependencies within `mix.exs` to include obelisk, as well as the Erlang library yamerl. defp deps do [{ :obelisk, "~> 0.10.0" }, { :yamerl, github: "yakaz/yamerl"}] end Next we need to download obelisk and compile it $ mix deps.get $ mix deps.compile Now for the fun stuff, we can initialize our obelisk project $ mix obelisk init We can build our obelisk project now. It will look pretty basic without modifications to the layout (explained below), and some content. $ mix obelisk build Once our project is built, we can check it out by starting the server. $ mix obelisk server Now browse to `http://localhost:4000` ## Structure Now that we've got our project, you will notice that an obelisk project is set out with the following structure / /site.yml /themes/ /themes/default/ /themes/default/assets/ /themes/default/assets/css/ /themes/default/assets/js/ /themes/default/assets/img/ /themes/default/layout /posts/ /drafts/ /pages/ ## Creating a new post Obelisk expects blog post content to be located in the `/posts` directory, with filenames using the format `YYYY-mm-dd-post-title.markdown`. Any file matching this pattern will be processed and built into the `/build` directory. You can use the `post` command to quickly create a new post with todays date, although creating the file manually will also work. $ mix obelisk post "New obelisk feature" ## Creating a draft Just like the post above us, we can create a draft. Drafts are intended to hold works in progress, and won't be compiled into the `/build` directory when running the build command. Again, the `draft` command can be used to quickly create a new draft, although creating the file manually will also work. $ mix obelisk draft "Still working on this" ## Creating a page Pages are non-temporal content, such as an about page, which are built in the same way as posts, but not included in the site's RSS feed. These files can have any name, and need not start with a date stamp. For example `./pages/about-me.markdown` is a fine filename to use. Currently there is no command to create a page, however creating a file under `./pages` will work. ## Front matter Like other static site generators, posts should include front matter at the top of each file. --- title: My brand new blog post img: relative/path/to/bobby.png author: Bobby Tables twitter: littlebobbytables --- Post content goes here Now within the `post.eex` template, which we'll talk about a bit further down, we can access these value like this:
## Themes Since Obelisk v0.9.0, you are now able to customize your site with various themes. These themes are stored in the `/themes/` directory, each in their own individual directory. After the init task is run, you will have access to the default theme, in: /themes/default/ You can have multiple themes under the `themes` directory. The theme which is used at build time is determined by the `theme` setting in `./site.yml` --- ... theme: default ... ### Local Themes Local themes are those that you have created yourself and not yet shared with the world. A new theme can be created by making a new directory under `/themes` and including the required files and directories /themes/