AlexandreDecan / genja

Genja, a minimalist static website generator built on top of Jinja2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Genja

Introduction

Genja is a minimalist static website generator built on top of Jinja2. It allows you to easily create static website with the ease of the powerful templating library, Jinja2.

How to use it?

Download genja.py. It is a simple command-line interface that must be used to generate your website. Simply type python genja.py to create pages in the output directory.

Genja relies on some libraries to work. Type pip install -r requirements.txt to install them.

How to structure my website?

The static folder will be copied as-is in the output folder. Use it to store your assets, css, js, etc.

Both content and templates folders contain the templates that are required by Jinja2. By convention, use the templates folder to put those who corresponds to your layout and are not specific to a page. The ones in content will be used to generate the pages of your website.

Each file in content that does not start with an underscore and that ends with .html will be processed and converted in exactly one page in the output directory.

The default folders can be changed in genja.py. By default, all the files that are contained in the output folder will be removed when using the script. Be careful!

What else?

While processing the templates, the context of Jinja2 will be provided with some filters and values:

  • A filter |relative which translates a path relative to the root of the website to a path relative to current page location. For instance, if you use "A/page.html"|relative in B/test.html (under content), it will be translated to ../A/page.html. This allows you to define links without having to worry about what will be the root URL.
  • A dyanmic value page that equals the relative path (starting from the content folder) of the page being processed. Use this, e.g., for setting a .active class on links in your menu.
  • A function load_yaml that takes a path relative to content/ and returns the content of the YAML file.

About

Genja, a minimalist static website generator built on top of Jinja2.

License:GNU General Public License v3.0


Languages

Language:Python 96.0%Language:CSS 4.0%