readme (view raw)
1vite
2----
3
4A fast (this time, actually) and minimal static site generator.
5
6INSTALLING
7
8 go install git.icyphox.sh/vite@latest
9
10
11USAGE
12
13 usage: vite [options]
14
15 A simple and minimal static site generator.
16
17 options:
18 init PATH create vite project at PATH
19 build builds the current project
20 new PATH create a new markdown post
21
22
23CONFIG
24
25The configuration is unmarshalled from a config.yaml file, into the
26below struct:
27
28 type ConfigYaml struct {
29 Title string `yaml:"title"`
30 Desc string `yaml:"description"`
31 DefaultTemplate string `yaml:"default-template"`
32 Author struct {
33 Name string `yaml:"name"`
34 Email string `yaml:"email"`
35 } `yaml:"author"`
36 URL string `yaml:"url"`
37 }
38
39Example config: https://git.icyphox.sh/site/tree/config.yaml
40
41
42TEMPLATING
43
44Non-index templates have access to the below objects:
45• Cfg: object of ConfigYaml
46• Meta: map[string]string of the page's frontmatter metadata
47• Body: Contains the HTML
48
49Index templates have access to everything above, and a Posts object,
50which is a slice containing HTML and Meta. This is useful for iterating
51through to generate an index page.
52Example: https://git.icyphox.sh/site/tree/templates/index.html
53
54Templates are written as standard Go templates (ref:
55https://godocs.io/text/template), and can be loaded recursively.
56Consider the below template structure:
57
58 templates/
59 |-- blog.html
60 |-- index.html
61 |-- project/
62 |-- index.html
63 `-- project.html
64
65The templates under 'project/' are referenced as 'project/index.html'.
66This deserves mention because Go templates don't recurse into
67subdirectories by default (template.ParseGlob uses filepath.Glob, and
68doesn't support deep-matching, i.e. '**').
69
70More templating examples can be found at:
71https://git.icyphox.sh/site/tree/templates
72
73
74FEEDS
75
76Atom feeds are generated for all directories under 'pages/'. So
77'pages/foo' will have a Atom feed at 'build/foo/feed.xml'.
78
79
80FILE TREE
81
82 .
83 |-- build/
84 |-- config.yaml
85 |-- pages/
86 |-- static/
87 |-- templates/
88
89The entire 'static/' directory gets copied over to 'build/', and can be
90used to reference static assets -- css, images, etc. 'pages/' supports
91only nesting one directory deep; for example: 'pages/blog/*.md' will
92render, but 'pages/blog/foo/*.md' will not.