Skip to main content

Static site generator for GitHub Pages

Project description

Genja

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

Installation

Download and install Python from python.org or from Anaconda. Next, install Genja from PyPI using the following command:

pip install genja

Check the installed version from the command line:

genja --version

Usage

Before running Genja, create a project structure as shown below. The content directory contains Markdown files that are used to generate HTML files. The templates directory contains Jinja2 templates that are used to render the HTML pages. The docs directory contains the generated website which can be hosted with GitHub Pages. Lastly, the config.toml defines the base URL and directories for the project.

mywebsite/
|- content/
|- templates/
|- docs/
|- config.toml

The items in the config.toml are shown below. The base_url is the URL for the homepage of the website. Markdown files that are parsed by Genja are located in the markdown_dir directory. The Jinja2 templates used by Genja are located in the template_dir directory. The HTML files generated from Genja are located in the output_dir directory. Static content such as images and CSS files should go in the output directory.

base_url = "https://example.com/mywebsite"
markdown_dir = "content"
template_dir = "templates"
output_dir = "docs"

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 two example projects that can be built with Genja. The directory-website example uses the website directory for the generated output. The toplevel-output example uses the top-level of the project for the generated output.

Contributing

Clone this repository and use the conda environment file 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.

# Clone this project
git clone https://github.com/wigging/genja.git

# Create the conda environment
cd genja
conda env create --file environment.yml

# Activate the conda environment
conda activate genja

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 here 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-24.10.tar.gz (129.3 kB view details)

Uploaded Source

Built Distribution

genja-24.10-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genja-24.10.tar.gz
  • Upload date:
  • Size: 129.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for genja-24.10.tar.gz
Algorithm Hash digest
SHA256 77bbd864622b4659cc368d9e9974c454706ce6cec9e4834bf3aad924c78d71a2
MD5 b0965ce74c2af1985abbe774edf49823
BLAKE2b-256 5515346c2629a927fb005f50c6a75c745b499b597d92ab912603243721a32d4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genja-24.10-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for genja-24.10-py3-none-any.whl
Algorithm Hash digest
SHA256 76ce86d95e0c4ec74a3c5f2b476947947ba1a975d8b0a57c1ed56c630d7e7ba2
MD5 d5da3a802eeb34aacaaacdff42a6f7a2
BLAKE2b-256 2f3d190a2b9c2dc68944d4137506ed2699295771151191da5030a956f637878a

See more details on using hashes here.

Supported by

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