This repo is a stupid, simple, static site generator. It is very opinionated, but you can easily create static sites with jinja templates and json files. This basically cuts the framework out of rendering.
Getting Started
Install
To install from PyPi :
pip3 install sg1
Setup
sg1 start projectname
This creates 3 folders in a directory projectname:
templates: These are the jinja2 templates that will be rendered.
content: JSON files that specify the key value pairs used to render the templates.
html: Output directory of the rendering. This is where your beautifully* rendered html files are generated.
*Beauty not guaranteed.
Templates
See the jinja2 documentation
Content
Example:
# index.json
{
"template": "index.html",
"title": "I'm a title"
"p": "I'm a paragraph."
"extras": [
"about/about.json",
"posts"
]
...
}
The only required field is template which is the relative path from the templates folder.
The rest is whatever you want, just make sure the variables are in the template ({{ content.variable }}).
Simple URLs
sg1 urls projectname creates a urls folder in projectname with a urls.json file containing all the project urls for ease of use in the templates.
Example:
Let’s say you have a content file posts/post.json. The above command will add relative reference in the urls.json file like:
{
...,
"posts__post": "/posts/post.html",
...
}
You can then create a link in the template with <a href="{{ urls.posts__post }}">Post</a>.
HTML
To generate the HTML files, run sg1 render projectname.
To Do
☒ Add extras field to context files that automagically includes context of a specified subfolder (to easily use context from example_post.json to render the image and title in index.html for example).
☐ Pagination of extra
☐ Refactor and general cleanup
☐ Update paths for Windows
Metadata
Release files for sg1 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sg1-0.1.4.tar.gz | 7.4 kB | Without provenance | Details for sg1-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sg1-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for sg1-0.1.4-py3-none-any.whl |
Total release size: 14.8 kB
Release files / sg1-0.1.4.tar.gz
| Download URL | sg1-0.1.4.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57fb10516d3484afc30deaffa7b564a0baea546bf017d126e1a7a4b5a0b61bfa
|
|
BLAKE2b-256 checksum How to use checksums |
22ce4a59c78e5928e1a6b0c337209a292b7c436be6a94863f49952fd134fb258
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Release files / sg1-0.1.4-py3-none-any.whl
| Download URL | sg1-0.1.4-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34f293e480c76c4d3b9bd9ccd805b9f8f68c36c5e06a3d7f7a992af8d213c26a
|
|
BLAKE2b-256 checksum How to use checksums |
c2f364da73fcfa1c6dfd5cae383a293d42c172ea7d33ff00c819f30b2a794750
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Security for sg1 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.