smallpress

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: EUPL-1.2 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

small-press

A site from a folder of Markdown, written in Obsidian and built to be cited: a Go library, and a small program of each site's own on top of it.

One Go program reads a folder of Markdown and writes a static site, which nginx serves. Posts are written in Obsidian and published with the In the Open plugin, over Micropub, with their citations already formatted. small-press is that program's library: each site is a program of its own, with its own pages, templates and stylesheet, and the library does the rest. See Running it.


A blog post that cites its sources should be as easy to cite as a paper. Each post on a small-press site has its references, formatted once, in one style, and a page for every work it cites, with every post that cites it. It carries the tags Google Scholar and Zotero read, a BibTeX entry, and an address that never changes.

The rest stays small. Pages need no JavaScript, and there's no server program for visitors: a blog only changes when something is published, so every page is decided when the site is built. Images are dithered, and posts don't go away, because a citation has to keep working.


1 Running it

On a server, sites run on NixOS from this flake's module: services.small-press.sites, nginx serving each site, which the host builds itself from every push to the site's repository. See Deployment.

A new site starts as a copy of example/. See Sites.

To work on it, nix develop gives everything, and nix run .#dev serves the example on http://localhost:8080, rebuilt on every request. See Running.


2 Publishing

Posts are written in Obsidian, and the In the Open plugin sends them to the site's receiver, which commits them to the site's repository. A post is published when the host has built that commit. A post can be sent as a draft first, to see it on the site before anyone else does. A post can be withdrawn, but never deleted: its address keeps working.


3 Documentation

For whoever works on it:

  • Architecture - What the library is made of, where it ends and a site begins, the rules every site keeps to, and deployment.
  • Sites - What a site's repository holds, how one starts, and how it moves to a new release of the library.
  • Publishing - The receiver: how a post from In the Open becomes a commit.

4 License

The code is licensed under the EUPL-1.2.

This is the library of a few people's sites, public to read and reuse under that licence, but not a project yet: it has no stable API, and each site pins the release it builds with, so a release may break a site that moves to it. There's no support, and issues and pull requests aren't taken.

Documentation

Overview

Package smallpress makes a site from content/, as a site's own program asks it to: Main is that program's main. It writes the site to a folder (-out), as the Nix build does, or serves it while you write (-serve), built again on every request. With -receive it is the receiver, which takes posts over Micropub and commits them (receive.go).

Reading content/ is in package content, putting it together and checking it in site, Markdown in render, and every file but the pages in build. The pages are the site's own: Site.Pages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(st Site)

Main is a site's program: its flags, and the three ways to run.

Types

type Site

type Site struct {
	// Pages writes the site's pages, from its templates and static files in
	// assets: one at every address the site gives something (build.Verify),
	// and the static files (build.Static). Every other file is the
	// library's (build.Common).
	Pages func(s *site.Site, assets fs.FS, o build.Options) (build.Files, error)
	// Assets are the templates and static files, embedded in the program.
	Assets fs.FS
	// Options are what the site's checks need to know about its pages.
	Options site.Options
}

A Site is what a site's own program gives Main: how its pages look.

func (Site) Build

func (st Site) Build(contentFS, assets fs.FS, o build.Options) (build.Files, error)

Build is the whole site from content: read, checked, and every file written into memory, the site's pages and the library's.

Directories

Path Synopsis
Package build writes everything about a site that isn't how its pages look: the feed, the sitemap, each post's cite.bib and images, robots.txt, the files nginx includes, and the static files.
Package build writes everything about a site that isn't how its pages look: the feed, the sitemap, each post's cite.bib and images, robots.txt, the files nginx includes, and the static files.
Package content reads content/: the site's facts, its posts, pages, threads and works.
Package content reads content/: the site's facts, its posts, pages, threads and works.
Package dither gives a photo the site's look: grey, at most size pixels wide or high, in six shades with an ordered (Bayer 8×8) pattern, as hitherdither makes it of a grey photo.
Package dither gives a photo the site's look: grey, at most size pixels wide or high, in six shades with an ordered (Bayer 8×8) pattern, as hitherdither makes it of a grey photo.
Command example is a whole site on small-press, for its tests and for a new site to start from: its pages (pages.go), templates and stylesheet (web/), and content/.
Command example is a whole site on small-press, for its tests and for a new site to start from: its pages (pages.go), templates and stylesheet (web/), and content/.
web
Package web holds the templates and the stylesheet, embedded in the program.
Package web holds the templates and the stylesheet, embedded in the program.
Package micropub is the receiver: it takes posts from the In the Open plugin over Micropub, with the references extension, and commits them to the site's repository.
Package micropub is the receiver: it takes posts from the In the Open plugin over Micropub, with the references extension, and commits them to the site's repository.
Package render turns Markdown into HTML: CommonMark with GFM tables, strikethrough, footnotes and task lists.
Package render turns Markdown into HTML: CommonMark with GFM tables, strikethrough, footnotes and task lists.
Package site is the site as a whole: posts newest first, their threads, the works they cite, which posts link to which, and every check that needs more than one file.
Package site is the site as a whole: posts newest first, their threads, the works they cite, which posts link to which, and every check that needs more than one file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL