https://github.com/grz0zrg/static
Minimalist Static Website Tool
https://github.com/grz0zrg/static
Last synced: 3 months ago
JSON representation
Minimalist Static Website Tool
- Host: GitHub
- URL: https://github.com/grz0zrg/static
- Owner: grz0zrg
- License: mit
- Created: 2018-07-29T13:36:20.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-16T16:54:55.000Z (almost 7 years ago)
- Last Synced: 2025-01-29T12:28:31.599Z (5 months ago)
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Minimalist Static Website Tool
This Python 2.x tool was built to produce my portfolio at : http://www.onirom.frYou can find a complete usage example here : https://github.com/grz0zrg/portfolio
It provide a simple way to produce static HTML pages content from a combination of JSON data definitions and HTML templates, tags related to JSON definition in the form of `{tag}` can be used inside the template files along with simple conditional tags.
It also generate the sitemap file.
While it lack many features, this tool work great if your website has a simple structure with a navigation menu and pages listing items, ideal as a portfolio generator.
### Example
Directory structure (folders) :
* json
* nav.json
* items.json
* template
* nav.html
* items.html
* dist
* get
* *this is a folder where you place all downloadables stuff, all the content of this folder will be included in the sitemap*
* index.html#### sitemap
The sitemap will be automatically generated from the pages definition AND from all files in the `get` folder (recursively), all pages are given priority 1.0 with monthly update (can be changed in the source).
#### nav.json
This list all the pages to be generated, in this case a `software.html` and `library.html` will be produced, page name with space character are converted automatically with space replaced by an underscore so that "software library" produce a "software_library.html" file.
```json
{
"pages": [
{
"name": "software"
},
{
"name": "library"
}
]
}
```#### nav.html
The template file linked to `nav.json` which will generate a list of items, allowed tags :
* `name`
* The page name
* `_name`
* The page name as it was defined in the `nav.json` file (without space character conversion)
* `active`
* This will be replaced by the string `active` if this item correspond to the generated page (so it can be highlighted as current page with a CSS class or something)```html
{_name}
```
#### items.json
This list all available definitions for each pages, all properties listed here can be used inside the `items.html` template file, you can use an array as a value so that each items are enclosed within a div (great for styling a list of items like tags)
```json
{
"software": [
{
"thumb_url": "assets/thumb/my_software.png",
"thumb_alt": "Software example",
"link": "https://mysoftware.com",
"title": "Software example",
"tags": ["C", "Embedded systems", "REST", "JSON"]
}
],
"library": [
{
"thumb_url": "assets/thumb/mylibrary.png",
"thumb_alt": "Library example",
"link": "https://mylibrary.com",
"title": "Library example",
"tags": ["C/C++", "Linux"]
}
]
}
```
**Note** : You can self-reference an item tag within itself, for example you can do : `"title": "{link}"`
#### items.html
The items template file linked to `items.json`
```html
%%linklink%%
{title}
%%linklink%%
```
##### %%tag
Simple conditional which indicate that the content enclosed between **%%tag** and **tag%%** should be removed if **tag** is empty; this remove the link element if the link is empty in the example above.
**Note** : An item `{tag}` is removed if it exist in the template file but not in the definition file.
#### index.html
Your HTML skeleton, all pages will be generated from this page, you can use a tag of the same name as the JSON files to specify where the generated items goes such as `{nav}` and `{items}` in this example.
You can also use the tag `{date}` to place the generation date.
```html
{nav}
{items}
generated on {date}