···11-go-vite
22--------
11+vite
22+----
3344A fast (this time, actually) and minimal static site generator.
5566-NOTE: At this point, a lot of this code is heavily tailored towards my
77-own site.
88-99-106INSTALLING
1171212-Clone this repository and run
1313-1414- $ make
1515- # make install
1616-1717-Requires `go` to be installed, obviously.
88+ go get git.icyphox.sh/vite
18919102011USAGE
21122222- vite [options]
1313+ usage: vite [options]
23142415 A simple and minimal static site generator.
2516···2920 new PATH create a new markdown post
302131223232-CONFIGURATION
2323+CONFIG
33243434-vite expects a config.yaml file to exist in the project root. You can
3535-refer https://git.icyphox.sh/site/tree/config.yaml for an example
3636-containing all possible keys.
2525+The configuration is unmarshalled from a config.yaml file, into the
2626+below struct:
37272828+ type ConfigYaml struct {
2929+ Title string `yaml:"title"`
3030+ Desc string `yaml:"description"`
3131+ Author struct {
3232+ Name string `yaml:"name"`
3333+ Email string `yaml:"email"`
3434+ } `yaml:"author"`
3535+ URL string `yaml:"url"`
3636+ }
38373939-TEMPLATING
3838+Example config: https://git.icyphox.sh/site/tree/config.yaml
40394141-vite uses Go templating[2], and exposes two structure instances for
4242-rendering stuff in your template: `Cfg` and `Fm`, defined like so:
43404444- // Cfg
4545- struct {
4646- Title string `yaml:"title"`
4747- Header string `yaml:"header"`
4848- DateFmt string `yaml:"datefmt"`
4949- SiteURL string `yaml:"siteurl"`
5050- Description string `yaml:"description"`
5151- Author map[string]string `yaml:"author"`
5252- Footer string `yaml:"footer"`
5353- Prebuild []string `yaml:"prebuild"`
5454- Postbuild []string `yaml:"postbuild"`
5555- RSSPrefixURL string `yaml:"rssprefixurl"`
5656- }
4141+TEMPLATING
57425858- // Fm
5959- struct {
6060- Template string
6161- URL string
6262- Title string
6363- Subtitle string
6464- Date string
6565- Body string
6666- }
4343+Non-index templates have access to the below objects:
4444+· Cfg: object of ConfigYaml
4545+· Meta: map[string]string of the page's frontmatter metadata
4646+· Body: Contains the HTML
4747+4848+Index templates have access to everything above, and a Posts object,
4949+which is a slice containing HTML and Meta. This is useful for iterating
5050+through to generate an index page.
5151+Example: https://git.icyphox.sh/site/tree/templates/index.html
67526868-For an example, refer https://git.icyphox.sh/site/tree/templates
5353+More templating examples can be found at:
5454+https://git.icyphox.sh/site/tree/templates
695570567171-FEEDS
5757+FILE TREE
72587373-vite generates Atom feeds for all documents under the `pages/blog/`
7474-directory. I plan to add generation for arbitrary directories, with
7575-ability to configure the feed file name (defaults to feed.xml right
7676-now).
5959+ .
6060+ ├── build/
6161+ ├── config.yaml
6262+ ├── pages/
6363+ ├── static/
6464+ └── templates/
77657878-[1]: https://github.com/icyphox/site
7979-[2]: https://golang.org/pkg/html/template/
6666+The entire 'static/' directory gets copied over to 'build/', and can be
6767+used to reference static assets -- css, images, etc. 'pages/' supports
6868+only nesting one directory deep; for example: 'pages/blog/*.md' will
6969+render, but 'pages/blog/foo/*.md' will not.