A Simple Static Site Generator
Project description
Simple SSG
This is a very simple static site generator. It was made for one purpose alone: to decouple a static sites content from its document structure.
Install
To install the package run the following command:
pip install sssg
Use
Before running, you should create a pages.json file, and all template and content files references in it. Below is an example of how a directory structure might look.
├── pages.json
├── templates
| ├── home.html
| ├── ...
└── content
├── title.txt
├── ...
By default the path of the pages.json is named as such and located in the root directory. The base template and content directory are also as above, but all three can be configured with command line arguments. To see the list of arguments run the following command.
python -m sssg -h
Your pages.json file contents may look something like this:
[
{
"template": "./home.html",
"target": "./index.html",
"content": {
"title": "./title.txt"
}
}
]
For the example lets say your /templates/home.html file contents looks like this:
<!DOCTYPE html>
<html>
<head>
<title>{title}</title>
</head>
<body>
<h1>{title}</h1>
</body>
</html>
And lets say your /content/title.txt looks like this:
Test Title
Now run the following command:
python -m sssg
This will generate your static files, which will look like this:
...
└── static
├── index.html
├── ...
Where the contents of index.html is:
<!DOCTYPE html>
<html>
<head>
<title>Test Title</title>
</head>
<body>
<h1>Test Title</h1>
</body>
</html>
I hope this explains the basics of how to use sssg.
Project details
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 sssg-0.0.4.tar.gz.
File metadata
- Download URL: sssg-0.0.4.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd7501c8a082d4632609250c9a8c28a62ab17515126216e24d6a673ac47b7fd3
|
|
| MD5 |
afabdf2d853829ad373817629101c461
|
|
| BLAKE2b-256 |
a383f877692ddea036736ff03904dcb5acc5f37b66ebe707dc13c6133c584bcb
|
File details
Details for the file sssg-0.0.4-py3-none-any.whl.
File metadata
- Download URL: sssg-0.0.4-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9834fadfe4a61b70644854d34b5734ae2558f581a989e99bb61de8042a59400e
|
|
| MD5 |
668e91b93251dbb67751bb3642e797b0
|
|
| BLAKE2b-256 |
1e23afc8176b39bd1be2276f0bcf4bd21ee3e42f570c702a06cd1074054a2485
|