Skip to main content

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:

  1. templates: These are the jinja2 templates that will be rendered.

  2. content: JSON files that specify the key value pairs used to render the templates.

  3. 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)

Source distribution for sg1 0.1.4
File Size Uploaded
sg1-0.1.4.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sg1 0.1.4
File Interpreter ABI Platform
sg1-0.1.4-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page