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
42SYNTAX HIGHLIGHTING
43
44vite uses chroma (https://github.com/alecthomas/chroma) for syntax
45highlighting. Note that CSS is not provided, and will have to be
46included by the user in the templates. A sample style can be generated
47by running:
48
49 go run contrib/style.go > syntax.css
50
51
52TEMPLATING
53
54Non-index templates have access to the below objects:
55• Cfg: object of ConfigYaml
56• Meta: map[string]string of the page's frontmatter metadata
57• Body: Contains the HTML
58
59Index templates have access to everything above, and a Posts object,
60which is a slice containing HTML and Meta. This is useful for iterating
61through to generate an index page.
62Example: https://git.icyphox.sh/site/tree/templates/index.html
63
64Templates are written as standard Go templates (ref:
65https://godocs.io/text/template), and can be loaded recursively.
66Consider the below template structure:
67
68 templates/
69 |-- blog.html
70 |-- index.html
71 |-- project/
72 |-- index.html
73 `-- project.html
74
75The templates under project/ are referenced as project/index.html.
76This deserves mention because Go templates don't recurse into
77subdirectories by default (template.ParseGlob uses filepath.Glob, and
78doesn't support deep-matching, i.e. **).
79
80More templating examples can be found at:
81https://git.icyphox.sh/site/tree/templates
82
83
84FEEDS
85
86Atom feeds are generated for all directories under pages/. So
87pages/foo will have a Atom feed at build/foo/feed.xml.
88
89
90FILE TREE
91
92 .
93 |-- build/
94 |-- config.yaml
95 |-- pages/
96 |-- static/
97 |-- templates/
98
99The entire static/ directory gets copied over to build/, and can be
100used to reference static assets -- css, images, etc. pages/ supports
101only nesting one directory deep; for example: pages/blog/*.md will
102render, but pages/blog/foo/*.md will not.