Skip to main content

Static Website Builder

Project description

Thera

A Python script for building static HTML websites from Markdown text files, using the Mako template engine. Excellent support for blogs: allows YAML metadata in the blog markdown files, can create an Atom-compatible RSS feed.

Why use it?

  • Simple: Requires one file to generate the site.
  • Reliable: A static website of HTML files has almost nothing to break. Immune to the Slashdot effect.
  • Secure: No database to break into. Fewer moving parts gives hackers fewer entry points into your website.
  • Fast: Static pages are pre-compiled HTML, ready for display.

Minimalist design reduces maintenance headaches.

How to install it

pip3 install thera

How to use it

thera.py <markdown file(s)>

Options

-h --help             Show help.
-b --blog             Build blog files.
-c --config           Configuration file path.
-C --clean            Delete distribution directory.
-s --static           Static directories paths (javascript, css).
-t --template         Page template file path.

YAML

YAML can be used in the markdown files:

---
Title: Hello world
Date: 09 Apr 2018 07:00 AM -0400
Slug: hello
Summary: A new blog for tech, business, and other oddments.
---
Hello. This is a new blog with a focus on tech and business.

Note: To generate an RSS feed the YAML date must include the offset from Coordinated Universal Time (UTC). In the example above, the offset is -0400.

Template tags

Blog RSS XML page

  • ${articles}: A list of page data dictionaries (explained below).
  • ${now}: The current date/time in UTC.

Blog archive page: a list of articles

  • ${data}: A dictionary where the key is a year and the value is a list of page data dictionaries (explained below) of articles for that year.

All other pages

  • ${data}: The page data dictionary with the following keys:
    • content: The markdown page converted to HTML without the template applied.
    • display-date: Allows the web pages to use a different date format than the YAML date.
    • slug: The part of an URL identifying the page in human-friendly words. For example in https://seagrape.us/blog/space-race.html, space-race is the slug. If a slug isn't in the YAML metadata, Thera uses the markdown file name.
    • summary: The summary of an article. Can be used in the RSS feed or the blog archive page.
    • title: The web page title. If a title isn't in the YAML metadata, Thera uses the <h1> header.
    • utc-date: The UTC version of the YAML date. Used in the RSS feed.

How to get it

License

MIT License.

Contact me

Bug reports and patches can be sent to craig@seagrape.us.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thera-3.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

thera-3.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file thera-3.0.tar.gz.

File metadata

  • Download URL: thera-3.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for thera-3.0.tar.gz
Algorithm Hash digest
SHA256 d70eb42618347e4df0c5e0c35ede2ba0d7c757293a3471d740dd604e5478c5cf
MD5 dd170e9a262adc730a9eb1a3f1db7e24
BLAKE2b-256 613920f2b044c768dbc3a59234fd5edf208b1813595ed32832fcbbebd752dc9e

See more details on using hashes here.

File details

Details for the file thera-3.0-py3-none-any.whl.

File metadata

  • Download URL: thera-3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for thera-3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4a9fd8f66d0f45c9b91412652e75ecc514577d99b10baf41d7137aae27184ef7
MD5 1af07826101117059161bb67344fef89
BLAKE2b-256 44c6509f8766bc0f272ab8b889f3f67bbb2182ecbcf52bec21b4960a95e50daa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page