diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-27 06:55:35 -0500 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-27 06:55:35 -0500 |
| commit | 121a3c10621bf093e51d4fe08fdd0432ef5e6782 (patch) | |
| tree | 33258270fd0764262578e9ff9e6f577dc0fe4172 | |
| parent | Add initial version of ssg (diff) | |
| download | ssg-121a3c10621bf093e51d4fe08fdd0432ef5e6782.zip | |
Update readme with more information on how to use ssg
| -rw-r--r-- | README.md | 72 |
1 files changed, 71 insertions, 1 deletions
@@ -1,4 +1,74 @@ # ssg -> a tiny static site generator +`ssg` is a tiny static site generator that can render HTML templates based on +JSON data files. +## Installation + +```bash +git clone https://git.sr.ht/~eugenetriguba/ssg +cd ssg +make install +``` + +If you want to uninstall later: +``` +make uninstall +``` + +## Quick Start + +```bash +ssg init mysite +cd mysite +ssg build +ssg serve +``` + +Open http://localhost:8080 to view your site. + +## Directory Structure + +``` +mysite/ +├── data/ # JSON data files (become html template variables) +├── templates/ # HTML templates (rendered to output directory) +├── static/ # Static files (copied unchanged to output directory) +└── dist/ # Output directory (default) +``` + +## Commands + +| Command | Description | +|---------|-------------| +| `ssg init [dir]` | Create a new site | +| `ssg build` | Build the site | +| `ssg serve` | Start local HTTP server | +| `ssg version` | Print version | +| `ssg help [cmd]` | Show man pages | + +## Templates + +Templates use Go's `html/template` syntax. JSON files in `data/` become +template variables named after the file (minus `.json`). + +**data/projects.json:** +```json +[ + {"name": "foo", "url": "https://example.com/foo"}, + {"name": "bar", "url": "https://example.com/bar"} +] +``` + +**templates/index.html:** +```html +<ul> +{{range .projects}} + <li><a href="{{.url}}">{{.name}}</a></li> +{{end}} +</ul> +``` + +## Documentation + +See `ssg help` or `man ssg` for full documentation. |