Have you ever started writing a multi-page website, and despaired at the amount of repetition there is when changing a single navigation item across all of those pages?
You could learn to use PHP or Handlebar, but we have a simpler approach. Jerbil uses a single template file that you create ONCE, to apply a header and footer section to each page in your multi-page website. Jerbil also converts markdown to HTML in each of your individual webpages too.
Install and Run (Method A: using npm)
Install Jerbil via npm:
sudo npm install -g jerbil-cms
Then invoke it on the command-line for the first time, which will download the jerbil-all.jar
jerbil
Suppose your project is in /home/me/mywebsite
. Then to run jerbil:
cd /home/me/mywebsite
jerbil
That's it!
The content files in mywebsite/pages
will get combined with template.html
files in mywebsite/webroot
to make html files ready for serving.
You can use any web-server -- nginx
, http-server
or in fact Jerbil comes with a built-in web-server if you want (see the config options).
Install and Run (Method B: a Java jar)
Install Jerbil by downloading the jerbil-all jar.
Suppose your project is in /home/me/mywebsite
, and you downloaded the jar to /home/me/Downloads/jerbil-all.jar
. Then to run jerbil:
cd /home/me/mywebsite
java -jar /home/me/Downloads/jerbil-all.jar
That's it!
Directory Structure - The files for a basic Jerbil website
Here's an example Jerbil website: https://github.com/winterstein/jerbil-website
You can fork this as a way to get started.
There are 3 important folders:
pages
This holds the raw content of your pages.webroot
This is what gets served as the website. It is where the finished html files go. It also usually holds the template.html files. And it holds your images and css.config
Holdsjerbil.properties
for configuring Jerbil options. You can find out about the options byjerbil --help
pages
This is where your content goes. You can write in a mix of markdown and html.
In here, you'll see files that clearly have the markdown extension (.md) on them, but contain some HTML. You'll notice, that they don't have a head or body. And they have no imported CSS, JS, or anything. They simply contain the core content of a given page. The rest will come from a template.
webroot
In here, you will see a file labeled, "template.html". This HTML file contains all of the links for importing internal and external CSS, JS, as well as defining a navigation menu and a footer section. But yet, it doesn't actually have any real content in it, it is just a shell HTML file.
Jerbil works similarly to handlebar, but with much less headaches and a smaller learning curve.
Now that you've seen the directory structure, and the rendering capabilities of Jerbil, you have everything that you need to quickly build your next multi-page website with greater ease and with far less copy+pasting and multi-page editing.
Happy coding.