TinyGen

About ℹ️

TinyGen is a simple 'static' website and blog generator written in Python. In less than 1000 lines of code, it supports plugins, themes, and all major desktop operating systems. A full list of features can be found below.

TinyGen tries not to get in your way by not dictating what you put in your pages or how they are formatted or edited.

 ______________ 
< Use TinyGen! >
 -------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Features 💻

As of version 0.9, TinyGen has these features:

  • Plugin API system (being improved)
  • Theme system
  • Open source
  • Markdown
  • Easily editable template files
  • Blogs with RSS feeds
  • Drafts (for blog posts)
  • Less than 1000 lines of code
  • Uses only the Python standard library, plus Markdown.
  • Responsive webpages
  • HTML contains no JavaScript (you can add it if you want)
  • Readable HTML
  • Compatible with Windows, Mac, Linux, *BSD, and even Android (via Termux)

Usage

This section assumes *nix operating systems, you may need to adjust some things for Windows.

Site Creation:

Run TinyGen once to generate the config file:

$ ./tinygen.py

Edit the generated config.cfg

  • Under [SITE], change 'title' to the name of your website
  • Change 'author' to your name
  • Change 'description' to a short one sentence description of your site (used for SEO/social media)
  • Change 'footer' to whatever you want (use HTML)
  • Change 'domain' to your website's domain name (if served under a subdirectory, specify it, ex: example.com/tinygen/)
  • Add what URLs you want to navbar pages
  • OPTIONAL: Change 'theme' to the name of the theme you want, if it is installed
  • OPTIONAL: Edit the page template, source/page-template.html if you want

Create the Index (homepage)

Use HTML or Markdown to create your homepage

$ ./tinygen.py edit index

Create more pages

$ ./tinygen.py edit <page name>

Delete a page

$ ./tinygen.py delete <page name>

Rebuild the entire site (except blog)

$ ./tinygen.py rebuild

Preview your site

Either open generated/index.html in your browser, or:

$ ./tinygen.py server

and visit 127.0.0.1:8080 in your browser.

Blog Creation

The steps above are pretty much the same for blogs, except you may want to edit the social media links in the config, also the commands are a little different:

Create a blog post

$ ./tinygen.py blog edit <post title>

Which will immediately put it into the generated/ folder. However, if you just want to work on a post before it gets put into generated, do:

$ ./tinygen.py draft edit <post title>

For more draft commands (which are similar to normal commands):

$ ./tinygen.py help blog

Publishing

You can use the built in web server (if you change the IP to 0.0.0.0), but it was only designed for testing purposes, and is not ideal for production websites. You will want to use Caddy, nginx, or Apache.

Just take the contents of generated/ and put them into your website directory. The server where the contents are hosted does not require any special software.

Download & Install

There is an 'installation' script for Linux (tested on Debian Jessie-Stretch but should work for any system that uses APT), which is available here.

For other systems, resolve dependencies and clone the Git repo:

Dependencies

  • Install Python 3
  • Install Python Markdown library (pip3 install markdown)

Cloning the repo

git clone https://github.com/beardog108/tinygen.git

Powered by Python

Jump to top