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 Author struct {
32 Name string `yaml:"name"`
33 Email string `yaml:"email"`
34 } `yaml:"author"`
35 URL string `yaml:"url"`
36 }
37
38Example config: https://git.icyphox.sh/site/tree/config.yaml
39
40
41TEMPLATING
42
43Non-index templates have access to the below objects:
44• Cfg: object of ConfigYaml
45• Meta: map[string]string of the page's frontmatter metadata
46• Body: Contains the HTML
47
48Index templates have access to everything above, and a Posts object,
49which is a slice containing HTML and Meta. This is useful for iterating
50through to generate an index page.
51Example: https://git.icyphox.sh/site/tree/templates/index.html
52
53Templates are written as standard Go templates (ref:
54https://godocs.io/text/template), and can be loaded recursively.
55Consider the below template structure:
56
57 templates/
58 |-- blog.html
59 |-- index.html
60 |-- project/
61 |-- index.html
62 `-- project.html
63
64The templates under 'project/' are referenced as 'project/index.html'.
65This deserves mention because Go templates don't recurse into
66subdirectories by default (template.ParseGlob uses filepath.Glob, and
67doesn't support deep-matching, i.e. '**').
68
69More templating examples can be found at:
70https://git.icyphox.sh/site/tree/templates
71
72
73FEEDS
74
75Atom feeds are generated for all directories under 'pages/'. So
76'pages/foo' will have a Atom feed at 'build/foo/feed.xml'.
77
78
79FILE TREE
80
81 .
82 |-- build/
83 |-- config.yaml
84 |-- pages/
85 |-- static/
86 |-- templates/
87
88The entire 'static/' directory gets copied over to 'build/', and can be
89used to reference static assets -- css, images, etc. 'pages/' supports
90only nesting one directory deep; for example: 'pages/blog/*.md' will
91render, but 'pages/blog/foo/*.md' will not.