Skip to main content

A distributed micro-blog social network on the blockchain.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slag-0.4.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

slag-0.4.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file slag-0.4.0.tar.gz.

File metadata

  • Download URL: slag-0.4.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/3.7.3 Linux/5.1.6-arch1-1-ARCH

File hashes

Hashes for slag-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c2bb7ae3f874a4b03ff79bf82c04821802ca41826a5f1420eacffd68cccd5b95
MD5 161977a50e38eee12a396589cd4920b1
BLAKE2b-256 50ca5c00b9999bf20c7f4652990b0091ac29541a1f61e4f5dcf6bb8d8c3215c9

See more details on using hashes here.

File details

Details for the file slag-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: slag-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/3.7.3 Linux/5.1.6-arch1-1-ARCH

File hashes

Hashes for slag-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 990e4e56313e4165edd8560eab6b18856baa7c2fb92e42229b2b9ad69e9260c8
MD5 2c9e42fb1f75e8f8693b90e891ee54e4
BLAKE2b-256 ed80716f70955f96cba3964c417d1728e851bdf8e3d409f121f595a7254e8a0f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page