Home

blog @5ae23f6ccfdfa3979cbedb102bc7e11f4bec6a89 - refs - log -
-
https://git.jolheiser.com/blog.git
My nonexistent blog
blog / _example / articles / introduction.md
- raw
 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
---
title: "Introduction"
summary: "An introduction of `blog`"
time: 2024-02-17
category: Miscellaneous
authors:
  - name: "jolheiser"
    email: "john+blog@jolheiser.com"
---

# Hello and welcome to blog!

`blog` is a simple static blog generator!

<small>Truly cutting edge, I know. Never seen one of these before, have you?</small>

[tl;dr](#tldr)

```go
package main

import "fmt"

func main() {
  fmt.Println("Hello, blog!")
}
````

Things it can do:

- [x] Render code :pencil:
- [ ] Fill the void :black_circle:

## Why was blog created?

~~Because I needed a specific thing that other generators couldn't give me. Blog is up to 1000 times faster than \<hot other blog generator\>!!!~~

Because I wanted to, like many other projects in this space. Blog is designed to be simple (to me) with enough flexibility for someone else to use without
cursing at me (too much).

---

`blog` parses some templates and articles (in markdown format), renders them, and pushes them to an output directory.

It can handle emoji :bomb: and code highlighting:

```python
def main():
  print("Hello, blog!")
```


## tl;dr

Check out the [example](https://git.jolheiser.com/blog/tree/main/_example).

The `articles` dir contains a list of articles, namely this one.

The `templates` dir contains a handful of [go templates](https://pkg.go.dev/html/template) that make up how to render the blog.
- `article.tmpl` is a template for an individual article (this page).
- `index.tmpl` is the main blog overview.
- `base.tmpl` is a collection of [defined blocks](https://pkg.go.dev/text/template#hdr-Nested_template_definitions)
that are then re-used in `index.tmpl` and `article.tmpl` to create a cohesive look-and-feel.

Finally, `config.yaml` (which can also be TOML if desired) allows you to not have to continuously re-type all the flags to define things like your 
`--article-dir`, `--template-dir`, or `--out`.