A basic file-based blog engine written in rust, with the help of actix, ammonia, chrono, pulldown-cmark, rand, and regex.
Posts are in markdown format and are flat (one level deep).
The engine’s original implementation in clojure had to be abandoned due to memory limitations in deployment.
- Start by placing all markdown files (eg. your individual blog posts) into a folder situated at
db/
. The filenames should end in.md
, and each file can include metadata at the very top, with the format:key0: value0 key1: value10, value11, ... ::: Lorem ipsum ...
- Important! End the metadata declaration with a dinkus,
- where a dinkus is a line consisting of only colons and spaces and at least one 3-colon sequence (for example, ” : ::: ::::: ::: :”).
- A page with no metadata should have a dinkus as the first line.
- The
time
key takes the page creation time, in seconds-since-unix-epoch. - The
tag
key takes a comma-separated list of strings, representing the tags associated with the blog post. - The
script
key takes a comma-separated list of filenames (relative topub/js/
), which get appended as<script>
lines to the<head>
block. - The metadata are parsed manually, but for the parsing of the rest of the file (ie. the post itself), see pulldown-cmark and commonmark.
- Important! End the metadata declaration with a dinkus,
- example, db/neuromancer.md:
title: Neuromancer (William Gibson) time: 457488001 tag: Science Fiction, Cyberpunk script: wintermute.min.js ::: <h1>Part 1, Chiba City Blues</h1> ## 1 The sky above the port was the color of ...
- Execute the server with
cargo run
orcargo run --release
. - Visit
http://localhost/page/neuromancer
.