Skip to content

Getting started with Rootbeer ๐Ÿบ

Breadcrumb edited this page Jun 7, 2021 · 1 revision

Generating a site with Rootbeer is very easy.

First, install Rootbeer using:

pip install rootbeer

Once you have Rootbeer installed, you can now create a folder that will contain all of Rootbeer's files. Go into the directory and then create a new python file. Call it what ever you want. This is going to be where you initialize and run Rootbeer.

In your file, insert this code:

from rootbeer import RootbeerSSG

rb = RootbeerSSG()

And run it!

Rootbeer will create a lot of files. They should look like this, (main.py is what I called the main python file):

.
โ”œโ”€โ”€ content
โ”‚   โ”œโ”€โ”€ pages
โ”‚   โ”œโ”€โ”€ posts
โ”‚   โ””โ”€โ”€ static
โ”œโ”€โ”€ plugins
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ public
โ”œโ”€โ”€ themes
โ”œโ”€โ”€ .rbconfig
โ””โ”€โ”€ main.py

Let's take a look at each file that was created.

content/

This is where your static files, posts, and pages go.

content/static/

This is where your static files go. CSS, images, etc. all go in here, and will then be transferred into the public/ folder automatically.

content/posts/

This is where your markdown posts go. The posts are written in markdown and they will appear as posts. Both pages and posts have metadata that can be optional or required. You can see how to make certain metadata required or optional in the wiki page about the config file, and see the metadata options for posts in the posts wiki page.

content/pages/

Like the posts, they are written in markdown. This is where your pages will go.

plugins/init.py

If you want to install plugins for Rootbeer, all you have to do is place the folder containing the plugin's code in the folder and add it too the config file. There will be a wiki page on how to create plugins soon.

public/

This is where all your rendered HTML goes. You would upload this folder too a website host like Netlify (Netlify is just what I use. It is free, and easy too use).

.rbconfig

This is the config file. You can change the name when you initialize Rootbeer. Like this:

rb = RootbeerSSG(config_file='config.yml')

The config file uses YAML syntax to parse the configuration values.

Congratulations!

You have just used Rootbeer to create the first couple of files needed to create your own epic static blog! Read on to see how to use Rootbeer even more!!