Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 3.04 KB

README.md

File metadata and controls

83 lines (59 loc) · 3.04 KB

caddy-markdown-site

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.

Screenshot

A screenshot the index page of the demo website.

Requirements

  • Caddy 2.4 or later.
  • Optional:
    • Deno 1.31 or later to run the tests (just test).
    • entr for development (just dev).
    • just to run the tasks.

Features

  • 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 (but index.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.

Front matter

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: the lang HTML global attribute. If not specified, defaults to an empty string.
  • text_dir: the dir HTML global attribute. Defaults to auto.
  • title: The page title. Defaults to the request path.

Example

---
lang: en
title: Greeting
---
Hello, world!

License

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.