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.md
and 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.md
serves as the directory index (butindex.html
takes priority).- You can customize the look of your site without touching the main template.
Edit
templates/{head,header,footer}.html
to do it.head.html
links 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
: thelang
HTML global attribute. If not specified, defaults to an empty string.text_dir
: thedir
HTML 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.