Skip to main content

slag

A fresh, static microblog system based on modern block chain technologies.

Slag uses a list of Git repositories ("streams") to generate static HTML files. The targeted serving platform is GitHub Pages, but you can serve them however you want. Here is an example slag (repository here).

Installation

pip install slag

Usage

slag [OPTIONS] [PATHS]...

Options:
  -u, --baseurl TEXT           Base URL for all internal links
  -t, --target TEXT            Directory to dump rendered HTML
  -i, --include TEXT           Additional directories to include
  -s, --pagesize INTEGER       Number of posts to display per page
  -g, --maxparagraphs INTEGER  Number of preview paragraphs to display
  -x, --hrefsuffix             Remove .html suffix from internal links
  -d, --datefmt TEXT           Format to pass to strftime() for dates
  -c, --config TEXT            Config file to load

Config files are specified in TOML. Any options specified on the command line override the options specified in the config file. By default, a file named slag.toml is loaded as the config.

Streams

Each source repository is used as a different "stream" of posts. Slag generates a "post" from each commit in the stream repositories, except those that having a leading ! in their commit message. A chronologically descending list of posts is generated for each individual stream as well as a single combined list of all streams.

Each post pulls its author, timestamp, URL slug, title, and body from the commit information. The first line of the commit message is used as the post title, while the rest are used as the post body. Content is formatted using Python Markdown. A number of paragraphs (specified by --maxparagraphs, defaults to 1) are used as 'preview' paragraphs in the list views.

Markdown Extensions

Slag supports some "extensions" (I guess you can call them that?) to work around some of the features of Git that aren't super ideal in a blogging system.

!file or !code

If a paragraph starts with !file or !code followed by a file path that exists in that commit's repository, Slag will expand the !file declaration into a syntax-highlighted code block. Slag uses the version of the file at its current HEAD rather than the version of the file in that commit. This works around Git's inability to edit the history immutable history feature.

!md

Like the !file extension, if a paragraph starts with !md and a file path, the paragraph is expanded to the contents of the given file and then rendered as Markdown. Again, Slag uses the version of the file at its current HEAD, enabling you edit posts without having to change your URLs. However, the act of editing a file will require a commit to the repository, which will then be used as a new post... so it's not a totally fool-proof workaround. Tough. Fixed: give your edit commit a leading ! and Slag will ignore it.

Motivation

Slag started as a personal shitpost project but it actually doesn't seem terrible. Some features of Git are fairly amenable to use in a blog engine like this, like me not having to write some database schema or clever file system layout to generate content from. Plus, it's easy to pull on guest authors or even include someone else's content in your own slag by adding it as a submodule. Neat.

Metadata

Release files for slag 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slag 0.4.0
File Size Uploaded
slag-0.4.0.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for slag 0.4.0
File Interpreter ABI Platform
slag-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / slag-0.4.0.tar.gz

Download URL slag-0.4.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c2bb7ae3f874a4b03ff79bf82c04821802ca41826a5f1420eacffd68cccd5b95
BLAKE2b-256 checksum
How to use checksums
50ca5c00b9999bf20c7f4652990b0091ac29541a1f61e4f5dcf6bb8d8c3215c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.16 CPython/3.7.3 Linux/5.1.6-arch1-1-ARCH

Release files / slag-0.4.0-py3-none-any.whl

Download URL slag-0.4.0-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
990e4e56313e4165edd8560eab6b18856baa7c2fb92e42229b2b9ad69e9260c8
BLAKE2b-256 checksum
How to use checksums
ed80716f70955f96cba3964c417d1728e851bdf8e3d409f121f595a7254e8a0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.16 CPython/3.7.3 Linux/5.1.6-arch1-1-ARCH

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

1 release file

0.2.0

1 release file

0.1.13

1 release file

0.1.12

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page