aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 3b7673646b7f3f2f17e7b62d6e6cca136824b345 (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
# benzin-next
Markdown-based blog template powered by NextJS.

Basically it's just a server that:

1. Pulls markdown from your CDN (could be even the simplest http server)
2. Generates and caches html
3. Serves it as static content

## Features
 - Markdown-first
 - No runtime JavaScript
 - Custom emoji support
 - Incremental Static Regeneration
 - Image optimization
 - Always in sync with your CDN
 - Built with `cgit` in mind

## CDN
You can use any web server as a CDN. The simplest way to run it locally is:
```bash
python3 -m http.server
```

In production it is recommended to use Nginx. For anything else you'll need a custom adapter.


## Adapter
At this moment there's only `nginxAdapter` available, but feel free to write your own based on your needs (e.g filesystem adapter). Keep in mind that you can't avoid running another server (CDN) for hosting your images, stylesheets and other static content.
```typescript
export interface Adapter {
  getStaticMarkdownPaths: (cdn: string) => Promise<GetStaticPathsResult['paths']>;
  getMarkdownSource: (cdn: string, path: string[]) => Promise<string>;
  getEmojiFileNames: (cdn: string, emojiRootPath: string) => Promise<string[]>;
}
```

## cgit
If you use `cgit` you can use it as CDN via *plain* view. Make sure that you have following settings for correct mime-types:
```
enable-html-serving=1

mimetype.html=text/html
mimetype.css=text/css
mimetype.jpg=image/jpeg
mimetype.jpeg=image/jpeg
mimetype.gif=image/gif
mimetype.pdf=application/pdf
mimetype.png=image/png
mimetype.svg=image/svg+xml
# ...etc
```

This has a nice side-effect of basically having a *continuous delivery* for free - you push changes to your repo, and since your repo is served via `cgit`, you can use it as CDN and keep your blog always up-to-date.


## TODO:
 - Openring support
 - Pre-render hooks
 - RSS feed