Skip to content

Extremely tiny static blog generator written in Ruby

Notifications You must be signed in to change notification settings

tenfensw/etblog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ETBlog (Extremely Tiny Static Blog Generator)

Installation (using RubyGems)

$ sudo gem install etblog -N

That’s it!

Installation (from sources)

First, you will obviously need Ruby 2.1 or newer.

You will need to install Kramdown and plist first:

$ sudo gem install kramdown plist -N

Then build and install this gem:

$ gem build etblog.gemspec
$ sudo gem install --local ./etblog-0.1.1.gem -N

Creating a blog

Basically, you need to use the etblog command-line utility to create and build blogs.

First, create a directory for your blog:

$ mkdir myblog
$ cd myblog

Now run etblog init to initialize the blog:

$ etblog init

After that, you should get this directory tree:

.
├── blog.plist
└── static

The blog.plist file is the configuration file of your blog. There, you can specify:

  • Your name and the name of your blog

  • The description of your blog

  • Links to various posts and sites that the user will see on the sidebar

Open it in your favorite text editor and change the name of your blog, specify your real name and change the description.

If you would like to change the folder where the compiled HTML files should be placed, change the Static option too.

Adding links is pretty easy. As the key, you specify the title of the link and as the value, you specify the href location of the link. Example (add this after <dict>):

<key>Tim K's website</key>
<string>http://timkoi.gitlab.io</string

After that, save the plist file and add some blog posts.

Adding blog posts is pretty easy too. You just create a markdown file with the post- prefix and write your blog in pure markdown. No need to specify the date or anything like that manually!

For example, let’s create a hello world post. The file name of our post should be post-helloworld.md. We just create that file near the blog.plist file and add some contents into it:

$ touch post-helloworld.md
$ nano post-helloworld.md

Example contents:

# Hello world
This is my first blog post on my ETBlog-based blog.

Now compile the blog:

$ etblog build

In the static folder (if you did not change the value of the Static key in the plist file), you should find:

static/
├── index.html
└── posts
    └── post-helloworld.md
        └── index.html

Now open the static/index.html file to see your blog and then (if you like it) publish it to your server and enjoy!

Creating custom themes

Basically, a theme is a single HTML page with external dependencies only that contains these tags that are later substituted by the ETBlog preprocessor:

  • @{post} - mandatory tag. Will be substituted with the title and the contents of the post. If you are building a Bootstrap-based ETBlog theme, put this tag inside <div class="container">.

  • @{title} - mandatory tag. Will be substituted with the name of the blog. If you are building a Bootstrap-based theme, put it in the navbar.

  • @{description} - optional tag. Will be substituted with the description of the blog.

  • @{links} - optional tag. Will be substituted with the links specified in blog.plist. If you are building a Bootstrap-based theme, put it in the navbar.