aboutsummaryrefslogtreecommitdiff

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:

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.

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