From 774a074458007dd7e4479e58ab47c87435cb7ecf Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 23 Oct 2022 00:12:24 +0300 Subject: docs: update README --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 935a0c6..41f2bc8 100644 --- a/README.md +++ b/README.md @@ -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; + getMarkdownSource: (cdn: string, path: string[]) => Promise; + getEmojiFileNames: (cdn: string, emojiRootPath: string) => Promise; +} +``` + +## 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. -- cgit v1.2.3