Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 1.53 KB

File metadata and controls

57 lines (43 loc) · 1.53 KB

webgen

A tiny static website generator.

This project is a work in progress and should be used by no one (yet).

Build

make

The binary is created at ./bin/webgen.

Usage

Commands

webgen --init creates a .webgen file in the current working directory. This tells webgen that you you really want to start managing files in this directory.

webgen builds the website.

webgen --verbose builds the website and prints every operation to stdout.

webgen --help prints the list of available commands along with short descriptions.

Directory structure

.
├── layout.html
├── pkg
│   ├── otherfile.txt
│   └── index.html
└── webroot
    ├── otherfile.txt
    └── index.html
  • layout.html contains the layout of your website. All pages on the website inherit from the layout. It should contain all of the HTML boilerplate, header, footer, etc. Go's HTML template language is used to determine where the content (from HTML files in webroot) is embedded in the generated HTML.
  • pkg is the destination for the compiled website.
  • webroot contains the website's content. HTML files are compiled into layout.html and copied into pkg with the same filename. For example, the contents of webroot/index.html is copied into the defined parts of layout.html and saved to pkg/index.html. All other files are simply copied to pkg without any kind of compilation/interpolation. e.g. webroot/static/foo.jpg is copied to pkg/static/foo.jpg.