This project is a proof of concept showing how you can serve Markdown files as reasonably good-looking minimal web pages with just the Caddy web server. It is not a static site generator; there is no build step. The project consists of a Caddy configuration file (Caddyfile), HTML templates, and CSS files. You will need some knowledge of Caddy to use and customize the project. Expect a lot of work, and possibly insurmountable barriers, if you decide to adapt it for anything but a simple website.
- Caddy 2.4 or later.
- Optional:
- If your page file is
demo/foo.mdand your domain example.com, you will be able to access the file as example.com/foo with no extension and example.com/foo.md. index.mdserves as the directory index (butindex.htmltakes priority).- You can customize the look of your site without touching the main template.
Edit
templates/{head,header,footer}.htmlto do it.head.htmllinks to the style sheets. - An error page is shown on error.
Markdown page files can include Caddy template front matter in JSON, TOML, or YAML. The front matter sets variables that configure how a page is presented.
The following variables are recognized:
lang: thelangHTML global attribute. If not specified, defaults to an empty string.text_dir: thedirHTML global attribute. Defaults toauto.title: The page title. Defaults to the request path.
---
lang: en
title: Greeting
---
Hello, world!
MIT.
index.html derives from the
index.html template used on the Caddy website.
axist.css is axist,
a classless CSS stylesheet.
photo.jpg is by Siarhei Plashchynski
on Unsplash.
Unsplash grants you an irrevocable, nonexclusive, worldwide copyright license to download, copy, modify, distribute, perform, and use photos from Unsplash for free, including for commercial purposes, without permission from or attributing the photographer or Unsplash. This license does not include the right to compile photos from Unsplash to replicate a similar or competing service.
