Render-engine plugin that mirrors single pages to /<slug>/index.html so clean URLs resolve alongside the original .html files.
Project description
render-engine-clean-urls
A render-engine plugin that
mirrors each single page's output to <slug>/index.html, so the page is
reachable at the clean URL /<slug>/ in addition to the original
/<slug>.html.
The plugin is non-destructive: the original <slug>.html file is left in
place, and a copy is written at <slug>/index.html. Existing internal links
of either form continue to work.
What gets rewritten
The plugin only mirrors top-level single pages that use the default
route (["./"]). The following are skipped:
- The homepage (slug
indexby default) Collections and the pages they generateDataObjects- Pages with an explicit class-level
path_name - Pages with a non-default
routesvalue
Install
pip install render-engine-clean-urls
Or with uv:
uv add render-engine-clean-urls
Usage
from render_engine import Page, Site
from render_engine_clean_urls import CleanURLsPlugin
app = Site()
app.plugin_manager.register_plugin(CleanURLsPlugin)
@app.page
class About(Page):
content_path = "about.html"
After app.render(), the output directory contains both:
output/about.html
output/about/index.html
so /about.html and /about/ both resolve to the same content.
Configuration
Skip additional slugs by registering with Site.register_plugins:
app.register_plugins(
CleanURLsPlugin,
CleanURLsPlugin={"skip_slugs": {"index", "robots"}},
)
skip_slugs defaults to {"index"}.
How it works
The plugin implements render-engine's post_build_site hook. After all
pages have been rendered to disk, it walks site.route_list, identifies the
single Page entries that should be mirrored, and copies each
output/<slug>.html to output/<slug>/index.html.
Because the work happens after the normal build, the plugin doesn't change
any page metadata, URLs returned by url_for(), or the site map.
License
MIT — see LICENSE.
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 render_engine_clean_urls-0.1.0.tar.gz.
File metadata
- Download URL: render_engine_clean_urls-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fee32f7df5c77f64dc8da92e616077c178007f3b979dc6065f42ad871f67949a
|
|
| MD5 |
60a4075197ee0ae2153c054ab5acb178
|
|
| BLAKE2b-256 |
78838da43d139189c28432d66df088b69c9be994639681588871bc127936f2db
|
Provenance
The following attestation bundles were made for render_engine_clean_urls-0.1.0.tar.gz:
Publisher:
publish.yml on kjaymiller/render-engine-clean-urls
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
render_engine_clean_urls-0.1.0.tar.gz -
Subject digest:
fee32f7df5c77f64dc8da92e616077c178007f3b979dc6065f42ad871f67949a - Sigstore transparency entry: 1548396917
- Sigstore integration time:
-
Permalink:
kjaymiller/render-engine-clean-urls@962e9dfdd9b08be4a0938456d038ddea9423bf0b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kjaymiller
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@962e9dfdd9b08be4a0938456d038ddea9423bf0b -
Trigger Event:
release
-
Statement type:
File details
Details for the file render_engine_clean_urls-0.1.0-py3-none-any.whl.
File metadata
- Download URL: render_engine_clean_urls-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7406897782b0cb914a8a28d5a320eee430d115ad41c248745bb65613b0b5c81f
|
|
| MD5 |
94004bf191a154d1997f9118c4ab1280
|
|
| BLAKE2b-256 |
911caf73d875c42c3828b22ba0fa4ebd99a49654c8c15f04e4325e5b05b7a74e
|
Provenance
The following attestation bundles were made for render_engine_clean_urls-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on kjaymiller/render-engine-clean-urls
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
render_engine_clean_urls-0.1.0-py3-none-any.whl -
Subject digest:
7406897782b0cb914a8a28d5a320eee430d115ad41c248745bb65613b0b5c81f - Sigstore transparency entry: 1548396947
- Sigstore integration time:
-
Permalink:
kjaymiller/render-engine-clean-urls@962e9dfdd9b08be4a0938456d038ddea9423bf0b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/kjaymiller
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@962e9dfdd9b08be4a0938456d038ddea9423bf0b -
Trigger Event:
release
-
Statement type: