This is a simple static site generator built in golang. I built it for my needs which are decidedly simple.
- VanJS built-in for dynamic content.
- Pico CSS support.
- Layout files for all your content. There is a default if you only have one layout.
- Support for HTML snippets/fragments.
- Support for HTML and Markdown content.
- Support for assets like images, javascript, css, etc.
- Hot reload development experience.
- One executable for build, dev, and deploy.
- Download the sssg release for your platform.
- Put your HTML (.html) and markdown (.md) pages in the ./src/pages directory. Nested directories are ok.
.html
and.md
files get wrapped in the layout so they don't have to been complete html docs. - Customize the layout in
./src/layouts/default.html
. This way you have one layout and all of your pages get wrapped in the same layout. Be sure to have__CONTENT__
somewhere in your layout. - In the layout file customize the link to your chosen CSS files. We've chosen Pico CSS to include in the init files.
- Put your static content (images, .js, .css, etc) in the ./src/assets directory and then link to the files like you normally would (/assets/js/whatever.js). They will be copied straight across to
./dist/assets
during the build process. - The required directory structure is like this.
my-site
├── dist // build will put your built site here, and deploy will deploy from here
└── src // build is expecting your source files to be here
└── assets // the contents of this directory will be copied straight across to /dist/assets
│ ├── css
│ │ ├── pico.colors.min.css
│ │ ├── pico.min.css
│ │ └── styles.css
│ ├── images
│ │ └── logo.png
│ └── js
│ └── app.js
├── snippets
│ └── Test.html
├── layouts
│ ├── alpinejs.html
│ ├── blog.html
│ ├── default.html
│ └── vanjs.html
└── pages
├── about.html
├── alpinejs.html
├── index.html
├── markdown.md
└── vanjs.html
- You don't have to create
./dist
. The build process will create it for you. - The
init
feature will create the./src
directory and all of its contents for you.
-
Download the sssg release for your platform.
-
To initialize your project with a minimal project skeleton:
- Create a project directory
~/code/my-site
. - Run
cd ~/code/my-site
. - Run
sssg init
to create the project skeleton in./src
. This is important because this is where the build expects your source files to be.
- Create a project directory
-
For development run
sssg dev
. This will:- Build the site.
- Serve the site on port 8080.
- Watch for file changes in the
./src
directory and then rebuild pages/content as needed. - Hot reload the browser after the site rebuilds when there is a file change.
-
To build run
sssg build
. This will put the rendered content in./dist
. -
To deploy:
- Configure private key SSH access to your server. Add your key to the ssh agent if you have a password-protected SSH key.
- Configure .env with DEPLOY_HOST, DEPLOY_PORT, DEPLOY_DIR
- Run
sssg deploy
. This will copy the contents of./dist
toDEPLOY_DIR
onDEPLOY_HOST:DEPLOY_PORT
. - If you are using ssss the updated content will be available at your site's URL.
- DONE. I may add support for dumb HTML snippets/fragments but maybe not.