Static site generator for GitHub Pages
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
Download and install Python from python.org or from Anaconda. After installing Python, create and activate a virtual environment as shown below:
python -m venv .venv
source .venv/bin/activate
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. 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 config.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
└── config.toml
The items in the config.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 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
Built Distribution
File details
Details for the file genja-24.11.tar.gz
.
File metadata
- Download URL: genja-24.11.tar.gz
- Upload date:
- Size: 222.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e876c5341bafde4d941c2e819574f8e0fbe5f5623375d373dd95a31aa712dfaf |
|
MD5 | 65af2cbba4ba84735a0e1e671525ff6f |
|
BLAKE2b-256 | 5aa864dfec2aece8cb2b2bdb8a5144e8b836e8917893fce2dd18669946b6bd22 |
File details
Details for the file genja-24.11-py3-none-any.whl
.
File metadata
- Download URL: genja-24.11-py3-none-any.whl
- Upload date:
- Size: 46.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ae982960e515c1a0319736e1eb1229c18823d8cf07ea2ed33d185387d1d94f3 |
|
MD5 | 67238987d9b68133e4b00ae4d945294f |
|
BLAKE2b-256 | 347b02134c9cedabee5482c7e2804cee1a61f53176e462227d1b51e4ed7afdef |