Skip to main content

Tiny lightweight static site generator written in Python that uses markdown and liquid to generate a website.

Project description

Buy Me a Coffee at ko-fi.com

Litestatic

Tiny lightweight static site generator written in Python that uses markdown and liquid to generate a website.

How it works

The way it works is simple by design. The litestatic script checks for a site directory, which is your website's source directory. A template site_template is provided as a submodule, which can be copied and modified for your site. The (site_directory)/templates directory contains liquid templates for generating the html skeleton of your website. Markdown is used for the webpage contents. The index.md is the markdown file that generates the front page of the website.

You can put markdown files in the site directory and have them generated as (site_directory)/(page name). You can also put html in the markdown files and it will render in the body.To customize the html outside the body use templates. For javascript you can source your scripts either in the markdown files or html template. You can also have blog-style posts by putting markdown files in the site/(posts_directory)/ directory. posts_directory is by default posts.

The name for the posts needs to be formatted as: (posts_directory)/YYYY-MM-DD-title.md.

The posts need to have a metadata header:

title: Post Title
date: YYYY-MM-DD HH:mm

Posts will be indexed in /posts which you can link in index.md or anywhere else.

The (site_directory)/files/ directory is for any miscellaneous files that get copied to the output directory out/.

The generated website is outputted to the output directory ready to be deployed to a web server or wherever.

Configuration

You can configure many things, such as blog post generation, the name of the index page, rss feed generation, and the posts directory.

To configure these things, copy the config_template.yaml to your site directory.

If you change the posts_directory you must also rename it in your site directory, since that is the directory it will look for at generation time. This will change the url where your posts are, for example if you want it to be /blog such as example.com/blog change the posts_directory to blog.

RSS Feed Generation

You can generate an RSS feed (posts_directory)/rss.xml by setting rss_feed_generation in the config.yaml to True. You need to set a site_url, language, and feed_description. If you do not set an index_page_title it uses the site_url as the RSS feed title.

How to use

First you need to install the requirements:

$ pip3 install -r requirements.txt

Next, install litestatic using pip:

$ python3 -m pip install .

Alternatively, if you want to run litestatic inside the source directory use the provided script:

$ ./litestatic

Next, either provide a site directory or use the template:

$ git submodule update --init
$ cp site-template (site_location)

Next, edit the site how you see fit.

Finally, to generate a website run:

$ litestatic (site_directory) (output_directory)

To view your website locally, run a web server:

$ python3 -m http.server -d (output_directory)

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

litestatic-0.0.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

litestatic-0.0.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file litestatic-0.0.1.tar.gz.

File metadata

  • Download URL: litestatic-0.0.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for litestatic-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1d9956c6d34264caf9be211fe2d7aba51c82acc1eb5d755fcb77bfb76b5dc9f9
MD5 16ca9d5c48f2a0be8e41ece702fb0005
BLAKE2b-256 4ff4aa943eeac591a2ca1764772d9143842fdfd660b25d8875960b791f70fbc5

See more details on using hashes here.

File details

Details for the file litestatic-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: litestatic-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for litestatic-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a3e51ca11350d64d3e7fea95d1cdee9703cd668683b1ebdc432614c8e8db67a
MD5 6a629c5585c9a13d21831c0798ef4908
BLAKE2b-256 b2c7d7ca224adbb0cf04c6a2d395ce41e931f107c3f67252006fb2be01627254

See more details on using hashes here.

Supported by

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