Name | ryland JSON |
Version |
0.8.0
JSON |
| download |
home_page | None |
Summary | A simple static site generation library |
upload_time | 2025-09-09 19:52:52 |
maintainer | None |
docs_url | None |
author | James Tauber |
requires_python | >=3.12 |
license | None |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Ryland
A simple static site generation library
## Current Features
- use of Jinja2 templates
- render page-level markdown
- render markdown within data using filter
- pull data directly from JSON or YAML files within templates
- copy static files and directory trees (for stylesheets, scripts, fonts, images)
- generate hash for cache-busting
## History
I've generally found the framework-approach of most static site generators to either be far too complex for my needs or too restricted to just blogs or similar. Over the years, I've generated many static sites with lightweight, bespoke Python code and hosted them on GitHub pages. I've ended up repeating myself a lot so I'm now cleaning it all up and generalizing my prior work as this library.
## Changelog
Now see `CHANGELOG.md`
## Example Usage
`pip install ryland` (or equivalent).
Then write a build script of the following form:
```python
from ryland import Ryland
ROOT_DIR = Path(__file__).parent.parent
OUTPUT_DIR = ROOT_DIR / "output"
PANTRY_DIR = ROOT_DIR / "pantry"
TEMPLATE_DIR = ROOT_DIR / "templates"
ryland = Ryland(output_dir=OUTPUT_DIR, template_dir=TEMPLATE_DIR)
ryland.clear_output()
## copy and hash static files
ryland.copy_to_output(PANTRY_DIR / "style.css")
ryland.add_hash("style.css")
## render templates
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
})
## and/or generate from Markdown files
PAGES_DIR = Path(__file__).parent / "pages"
for page_file in PAGES_DIR.glob("*.md"):
ryland.render_markdown(page_file, "page.html")
```
Also see `examples/` in this repo.
## Cache-Busting Hashes
The `add_hash` makes it possible to do
```html
<link rel="stylesheet" href="/style.css?{{ HASHES['style.css'] }}">
```
in the templates to bust the browser cache when a change is made to a stylesheet, script, etc.
## `markdown` Filter
To render a markdown context variable:
```html
{{ content | markdown }}
```
## Data Function
You can put together your template context in your Python build script or you can pull data directly from a JSON or YAML file within a template.
Here's an example of the latter:
```html
<div>
<h2>Latest News</h2>
{% for news_item in data("news_list.json")[:3] %}
<div>
<div class="news-dateline">{{ news_item.dateline }}</div>
<p>{{ news_item.content }}</p>
</div>
{% endfor %}
</div>
```
## Sites Currently Using Ryland
- <https://projectamaze.com>
- <https://digitaltolkien.com>
- <https://jktauber.com>
## Roadmap
In no particular order:
- move over other sites to use Ryland
- incorporate more common elements that emerge
- improve error handling
- produce a Ryland-generated website for Ryland
- document how to automatically build with GitHub actions
- write up a cookbook
- add a command-line tool for starting a Ryland-based site
Because Ryland is a library, a lot of missing features can just be implemented by the site developer.
However, if three or more sites duplicate effort in their build script, I'll consider at least adding helper code to Ryland.
Once five independent people are running sites built with Ryland, I will declare 1.0.0.
Raw data
{
"_id": null,
"home_page": null,
"name": "ryland",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": null,
"author": "James Tauber",
"author_email": "James Tauber <jtauber@jtauber.com>",
"download_url": "https://files.pythonhosted.org/packages/0a/2d/8736f3cea19339243075477f8ce4da266a342665bf2a4bb1e24f077f3d1d/ryland-0.8.0.tar.gz",
"platform": null,
"description": "# Ryland\n\nA simple static site generation library\n\n\n## Current Features\n\n- use of Jinja2 templates\n- render page-level markdown\n- render markdown within data using filter\n- pull data directly from JSON or YAML files within templates\n- copy static files and directory trees (for stylesheets, scripts, fonts, images)\n- generate hash for cache-busting\n\n\n## History\n\nI've generally found the framework-approach of most static site generators to either be far too complex for my needs or too restricted to just blogs or similar. Over the years, I've generated many static sites with lightweight, bespoke Python code and hosted them on GitHub pages. I've ended up repeating myself a lot so I'm now cleaning it all up and generalizing my prior work as this library.\n\n\n## Changelog\n\nNow see `CHANGELOG.md`\n\n\n## Example Usage\n\n`pip install ryland` (or equivalent).\n\nThen write a build script of the following form:\n\n```python\nfrom ryland import Ryland\n\nROOT_DIR = Path(__file__).parent.parent\nOUTPUT_DIR = ROOT_DIR / \"output\"\nPANTRY_DIR = ROOT_DIR / \"pantry\"\nTEMPLATE_DIR = ROOT_DIR / \"templates\"\n\nryland = Ryland(output_dir=OUTPUT_DIR, template_dir=TEMPLATE_DIR)\n\nryland.clear_output()\n\n## copy and hash static files\n\nryland.copy_to_output(PANTRY_DIR / \"style.css\")\nryland.add_hash(\"style.css\")\n\n## render templates\n\nryland.render_template(\"404.html\", \"404.html\")\nryland.render_template(\"about_us.html\", \"about-us/index.html\")\n\n# construct context variables\n\nryland.render_template(\"homepage.html\", \"index.html\", {\n # context variables\n})\n\n## and/or generate from Markdown files\n\nPAGES_DIR = Path(__file__).parent / \"pages\"\n\nfor page_file in PAGES_DIR.glob(\"*.md\"):\n ryland.render_markdown(page_file, \"page.html\")\n```\n\nAlso see `examples/` in this repo.\n\n\n## Cache-Busting Hashes\n\nThe `add_hash` makes it possible to do\n\n```html\n<link rel=\"stylesheet\" href=\"/style.css?{{ HASHES['style.css'] }}\">\n```\n\nin the templates to bust the browser cache when a change is made to a stylesheet, script, etc.\n\n\n## `markdown` Filter\n\nTo render a markdown context variable:\n\n```html\n{{ content | markdown }}\n```\n\n\n## Data Function\n\nYou can put together your template context in your Python build script or you can pull data directly from a JSON or YAML file within a template.\n\nHere's an example of the latter:\n\n```html\n<div>\n <h2>Latest News</h2>\n\n {% for news_item in data(\"news_list.json\")[:3] %}\n <div>\n <div class=\"news-dateline\">{{ news_item.dateline }}</div>\n <p>{{ news_item.content }}</p>\n </div>\n {% endfor %}\n</div>\n```\n\n## Sites Currently Using Ryland\n\n- <https://projectamaze.com>\n- <https://digitaltolkien.com>\n- <https://jktauber.com>\n\n\n## Roadmap\n\nIn no particular order:\n\n- move over other sites to use Ryland\n- incorporate more common elements that emerge\n- improve error handling\n- produce a Ryland-generated website for Ryland\n- document how to automatically build with GitHub actions\n- write up a cookbook\n- add a command-line tool for starting a Ryland-based site\n\nBecause Ryland is a library, a lot of missing features can just be implemented by the site developer.\nHowever, if three or more sites duplicate effort in their build script, I'll consider at least adding helper code to Ryland.\n\nOnce five independent people are running sites built with Ryland, I will declare 1.0.0.\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple static site generation library",
"version": "0.8.0",
"project_urls": {
"github": "https://github.com/jtauber/ryland"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b01f2dbcff666e12581c6be7bfafa38f6de504ad58c5d3f36cc464086253980a",
"md5": "4e451a3e7fe8e3428abc1b77ffb90025",
"sha256": "9871b1ccbf4b660520ccac0cedccb8d2d3717f7366522742694d836104f21958"
},
"downloads": -1,
"filename": "ryland-0.8.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4e451a3e7fe8e3428abc1b77ffb90025",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 4179,
"upload_time": "2025-09-09T19:52:51",
"upload_time_iso_8601": "2025-09-09T19:52:51.238648Z",
"url": "https://files.pythonhosted.org/packages/b0/1f/2dbcff666e12581c6be7bfafa38f6de504ad58c5d3f36cc464086253980a/ryland-0.8.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0a2d8736f3cea19339243075477f8ce4da266a342665bf2a4bb1e24f077f3d1d",
"md5": "36d62060b6844a70e36f6e514b7fd9f5",
"sha256": "3854d5bf645ad4c798ccbcd7871d6199580e0fce6ff5f9a4b0daffb8020e6a77"
},
"downloads": -1,
"filename": "ryland-0.8.0.tar.gz",
"has_sig": false,
"md5_digest": "36d62060b6844a70e36f6e514b7fd9f5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 3322,
"upload_time": "2025-09-09T19:52:52",
"upload_time_iso_8601": "2025-09-09T19:52:52.764084Z",
"url": "https://files.pythonhosted.org/packages/0a/2d/8736f3cea19339243075477f8ce4da266a342665bf2a4bb1e24f077f3d1d/ryland-0.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-09 19:52:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jtauber",
"github_project": "ryland",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ryland"
}