blob: acb7a301cef86a888ce57092f3a290eec226b1bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
name = MSG
description = An incredibly opinionated, hackable, minimal Static Site Generator.
languages = C
url = /projects/msg
template = project.html
link = https://github.com/compromyse/msg
linklabel = SOURCE
---
See [github.com/compromyse/compromyse.xyz](https://github.com/compromyse/compromyse.xyz) for an example site.
### Compilation & Usage
```sh
# REQUIREMENTS: CMake, Git, GCC/Clang, GNUMake/Ninja
$ git clone https://github.com/compromyse/msg
$ mkdir build && cd build
$ cmake ..
$ make # or ninja
$ ./msg -h
msg: The Minimal Static Site Generator
Usage: ./msg [-h] [-w] [-v] [-o <output>] <directory>
-h : Help
-w : Watch working directory for changes
-v : Verbose
-o <output>: Output directory
<directory>: Working directory
```
### Site Structure
```sh
.
├── assets
│ └── me.webp
├── config.cfg
├── index.html
├── partials
│ ├── footer.html
│ ├── navbar.html
├── projects.html
└── templates
└── base.html
```
### Features
#### Includes - include files from `/partials`
```html
<!-- index.html -->
<html>
<body>
{{ include "navbar.html" }}
...
</body>
</html>
```
#### Contentfor - define content for templates
```html
<!-- templates/base.html -->
<html>
<head>
{{ content "head" }}
</head>
<body>
{{ body }}
</body>
</html>
<!-- index.html -->
{{ contentfor "head" }}
<title>HOME</title>
{{ endcontent }}
<p>...</p>
```
#### Eachdo - iterate over resources
```html
<!-- projects/xyz.html -->
title = XYZ
---
<h1>XYZ!</h1>
<!-- index.html -->
{{ eachdo resources.projects }}
<p>{{ put title }}</p>
{{ endeachdo }}
```
#### Template - specify template for page
```html
<!-- projects/xyz.html -->
template = base_tailwind.html
---
<h1 class="p-2">XYZ!</h1>
```
|