Skip to main content

Static website generator

Project description

Genja

Genja is a simple static website generator. It is a Python command line tool that generates HTML files and a JSON feed from Markdown content.

Installation

The uv tool is recommended for Python installation and package management. After installing uv, use the tool command to install Genja as a command line tool on your computer:

$ uv tool install genja

Check the installed version from the command line:

$ genja --version

Usage

Before running genja, create a project structure as shown below. Markdown files go into the _pages and _posts directories. The pages directory is for standalone content that is not dated such as an about page or contact page. The posts directory is for dated content such as blog posts or articles. The _templates directory contains Jinja templates that are used to render the HTML pages. The mysite directory contains the generated website which can be hosted with GitHub Pages or some other web hosting platform. Lastly, the genja.toml file defines the URLs and directories for the project.

myproject/
├── mysite/
│   ├── img/
│   └── styles.css
├── _pages/
│   ├── about.md
│   └── contact.md
├── _posts/
│   ├── apple.md
│   └── orange.md
├── _templates/
│   ├── index.html
│   ├── page.html
│   └── post.html
└── genja.toml

The items in the genja.toml file are shown below. The base_url is the URL for the homepage of the website. The posts_output defines the output directory for the generated posts. The HTML files generated from Genja are located in the site_output directory. Static content such as images and CSS files should go in this directory. The title of the website is defined by the title key.

base_url = "https://example.com"
posts_output = "blog"
site_output = "mysite"
title = "My Website"

Use the serve command to build the website and start a local server. This will automatically open the default web browser to view the website. The website will automatically reload when changes are saved to the Markdown files.

$ genja serve

Use the build command to build the website without running a local server.

$ genja build

Examples

See the examples directory in this repository for projects that can be built with Genja. For more information about each example, see the Examples section in the Genja documentation.

Contributing

Clone this repository and use the uv tool to create a Python environment for developing Genja. This environment uses ruff for linting and formatting along with pytest for running tests. Genja is installed in editable mode within the environment. See the CONTRIBUTING document for more details.

Support

Support this project by using the :heart: Sponsor button at the top of this page. Thank you :smile:.

License

This project is licensed under the terms of the MIT license. See the LICENSE document for the license text.

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

genja-25.8.tar.gz (203.9 kB view details)

Uploaded Source

Built Distribution

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

genja-25.8-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file genja-25.8.tar.gz.

File metadata

  • Download URL: genja-25.8.tar.gz
  • Upload date:
  • Size: 203.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for genja-25.8.tar.gz
Algorithm Hash digest
SHA256 78627f6409e1c3d9b1bf18e2917a054a0dd00ea40ad6ad5098bfaa1433aaa9bb
MD5 27e380ce66c364426ddd0a8f2f4c909a
BLAKE2b-256 d7ffd5264b6d2e73a47f381ed03a6e6246763f5d79c6e458b25b810771634649

See more details on using hashes here.

File details

Details for the file genja-25.8-py3-none-any.whl.

File metadata

  • Download URL: genja-25.8-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for genja-25.8-py3-none-any.whl
Algorithm Hash digest
SHA256 115afee83b0472728daa985e53f774a9f831e1d74db5eb218fdc3d18674fd7a3
MD5 c4fcb980c3346f16e84a1cd965174f21
BLAKE2b-256 b6a04606a7e5221242c1fcb5387d60a16a5a4ff74f2c6d3e095ef7c9733fdb6f

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