Static site generator for GitHub Pages
Genja is a simple static site generator for GitHub Pages. It is a command line tool built in Python that generates HTML files and a JSON feed from Markdown content.
pip install genja
Check the installed version from the command line:
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 Jinja templates that are used to render the HTML pages. The
docs directory contains the built website which can be hosted with GitHub Pages. Lastly, the
config.json defines the URLs and directories for the project.
The items in the
config.json 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
input_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.
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.
Use the build command to build the website without running a local server.
To run the example, go to the
example directory in this repository. The
mdcontent folder is the input directory containing the Mardkown files. The
website folder is the output directory containing the built HTML files. Use the commands shown below to build the website and run a local server to view the website in the default web browser. The website will automatically reload in the web browser when changes are saved to the Markdown files.
Use the commands shown below to build the example website without starting a local server.
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
conda env create --file environment.yml
# Activate the conda environment
conda activate genja
Support this project by using the :heart: Sponsor button at the top of this page. Thank you :smile:.
This project is licensed under the terms of the MIT license. See here for the license text.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for genja-23.12-py2.py3-none-any.whl