~fancycade/wing

Blog engine written in Chicken Scheme
New post includes markdown header with title
Link blog in README
Update README with final notes

clone

read-only
https://git.sr.ht/~fancycade/wing
read/write
git@git.sr.ht:~fancycade/wing

You can also use your local clone with git send-email.

#wing

Static Site generator for buildings blogs written in Chicken Scheme.

Features:

  • Fast and easy CLI to setup blog, create new posts, or publish posts.
  • Use SXML to configure page layouts.
  • Automatically create and update atom feed.

For an example blog made with wing check out mine.

I've written a few blog posts about wing if you want some more context:

  1. Introducing wing
  2. Further work on wing

#Install

Ensure you have necessary native dependencies:

On Alpine Linux:

doas apk add chicken cmark-dev util-linux-dev

wing uses the cmark native C library as part of its markdown rendering process. Make sure that is installed before installing the egg.

It also uses the native C uuid library.

The easiest way to get started is to simply run:

chicken-install

This will use the egg file to download dependencies, compile the code, and install it.

#Build

chicken-install cmark sxml-transforms uuid simple-md5 srfi-19 srfi-13 srfi-1 atom

Use the chicken compiler to create the static wing binary.

csc wing.scm

#Usage

wing init
wing new
wing publish
wing revert
wing build
wing help

To initialize a project make a new directory. Inside the empty directory run wing init.

init - Prompt to fill in config file fields.

new - Prompt to fill in post fields.

publish - List unpublished posts and prompt the user to select one to publish. Publishing means the meta information is stored in the posts database.

revert - Remove the head (most recent) of the published posts list in posts.scm.

build - Read posts.scm and/or layouts.scm file generate static assets.

help - List commands with descriptions.

Use a file server to preview the built content in the static directory.

#Example File Servers

Typically one serves files with nginx, apache, or caddy. However, for local purposes you don't need all that.

Here are a couple of simple file servers that I like.

serve - Actually simple cli file server in Golang. No external dependencies.

serve -dir static

sfz - Easy to use, but not as simple as advertized.

sfz static

#Posts

Simply run:

wing new

Which will prompt you for the title, description, and tags. Dates are handled for you.

This will generate a markdown file in the posts directory.

Your post will look something like this:

title: hello world
summary: Saying hello to the world
tags: hello world blogging
---

The filename will be: hello-world.md

#Notes

To have multiline code blocks make sure to use 4 spaces on each line of code. Or else lowdown will put all lines of code on one line...

#Date Format

The date format used throughout wing is the RFC3339. The chicken scheme template string looks like this:

"~Y-~m-~dT~H:~M:~S"

wing uses a function called current-rfc3339-date to generate a string looking like this:

2020-03-18T02:58:10Z

#Post Tracking

wing uses a simple but powerful way to track updates of posts. The center piece of this design is the posts.scm file.

The most important thing to know about this file is don't touch this file!!!

This file looks like this:

(((title "")
  (summary "")
  (tags ("foo" "bar"))
  (path "")
  (id "")
  (md5 "")
  (published "") ;; RFC3339 date
  (updated ""))) ;; RFC3339 date

When build is run after any updates wing will adjust the updated date field and provide the new md5 hash field. This means there is no manual date effort on the author's part.

#Config

The config.scm file is generated by using the values provided in the initial prompt.

The most important thing to know about this file is don't touch this file!

((author "fancycade")
 (email "fancycade@protonmail.com")
 (description "")
 (domain "")
 (id ""))

#Contributing

For the most part I consider wing to be feature complete, but I am open to bug fixes and quality of life improvements.

Before sending patches make sure your changes pass the integration test:

./test.sh

Once you are confident in your changes you can send patches to:

~fancycade/public-inbox@lists.sr.ht

In the case you are new to email based git workflows please refer to this tutorial.

#License

wing: Simple Static Site generator for Chicken Scheme Copyright (C) 2020 fancycade@mycanofbeans.com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.