A simple static site generation library
Project description
Ryland
A simple static site generation library
Current Features
- Jinja2 templates and a basic markdown filter
- copying static files and directory trees (for stylesheets, scripts, fonts, images)
- cache-busting with hashes
History
I've generally found most static site generation libraries to either be far too complex for my needs or be too restricted to just blogs so, over the years, I've generated many static sites with lightweight, bespoke Python code and hosted them on GitHub pages. However, I've ended up repeating myself a lot so I'm now cleaning it all up and generalizing my prior work as this library.
Example Usage
For now, clone this repo and use as an editable requirement.
Write a build script of the following form:
from ryland import Ryland
ROOT_DIR = Path(__file__).parent.parent
DIST_DIR = ROOT_DIR / "dist"
PANTRY_DIR = ROOT_DIR / "pantry"
TEMPLATE_DIR = ROOT_DIR / "templates"
ryland = Ryland(dist_dir=DIST_DIR, template_dir=TEMPLATE_DIR)
ryland.clear_dist()
ryland.copy_to_dist(PANTRY_DIR / "style.css")
ryland.calc_hash("style.css")
ryland.render_template("404.html", "404.html")
ryland.render_template("about_us.html", "about-us/index.html")
# construct context variables
ryland.render_template("homepage.html", "index.html", {
# context variables
})
Cache-Busting Hashes
The calc_hash makes it possible to do
<link rel="stylesheet" href="/style.css?{{ HASHES['style.css'] }}">
in the templates.
Markdown Filter
To render a markdown context variable:
{{ content | markdown }}
Sites Currently Using Ryland
Roadmap
- move over other sites to use Ryland
- incorporate more common elements that emerge
- produce a Ryland-generated website for Ryland
- document how to automatically build with GitHub actions
- write up a cookbook
- add a command-line too for starting a Ryland-based site
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ryland-0.1.0.tar.gz.
File metadata
- Download URL: ryland-0.1.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bef76c54fd8e846ca8ed6c4b7b301e75e40e155fbcf0b3317e44c18e9ec4768d
|
|
| MD5 |
a9dd367df4b3337eff0b65e95703074d
|
|
| BLAKE2b-256 |
d426dc3d48b706a21e533b31b3356d81932b5b531dd6e2144843db9360000b7d
|
File details
Details for the file ryland-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ryland-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03ecba6c59fd37fa4b541c05c8e201f9e3e0c310f99aada7f7a0d3631d8591cc
|
|
| MD5 |
fe6d4d9fa81e99be41811b74b357929c
|
|
| BLAKE2b-256 |
c7834600ae92d85abdfc86ab5d0757c062c80cfff0ea74478329c574f186e52e
|