diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-10-23 00:12:24 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-10-23 00:12:24 +0300 |
commit | 774a074458007dd7e4479e58ab47c87435cb7ecf (patch) | |
tree | 29ffb49ccfb2f7351c60233b76e22a5d758fa67f | |
parent | a32257569190727e12c7e433b82e0a6da0fdc2f4 (diff) | |
download | benzin-next-774a074458007dd7e4479e58ab47c87435cb7ecf.tar.gz |
docs: update README
-rw-r--r-- | README.md | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -13,3 +13,41 @@ Basically it's just a server that: - 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. |