Simple blog site to post write ups. Content uses minimal formatting in Markdown. Servered up as HTML with basic navigation. https://posts.monoexp.com

bajdev 1644fa3fdb Merge branch 'feature/header-about-config' of bajdev/posts into main 2 днів тому
content 0bd42c4219 Document file names and front matter in the hello-world post 2 днів тому
static ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
templates ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
.gitignore 8ad17bd65c Add Markdown blog server 2 днів тому
LICENSE ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
README.md ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
about.md ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
config.go ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
config_test.go ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
feed.go 8ad17bd65c Add Markdown blog server 2 днів тому
go.mod 8ad17bd65c Add Markdown blog server 2 днів тому
go.sum 8ad17bd65c Add Markdown blog server 2 днів тому
main.go ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
main_test.go ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
posts.go 8ad17bd65c Add Markdown blog server 2 днів тому
posts_test.go 8ad17bd65c Add Markdown blog server 2 днів тому
render.go ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому
version.go ac317db16e Add About page, configurable Home link, RSS footer, MIT license 2 днів тому

README.md

posts

A small Go application that serves a Markdown blog at https://posts.monoaf.com.

Each Markdown file in content/ is one blog post. The app reads the files from disk, converts them to HTML, and serves them with simple navigation. Adding or editing a post does not require restarting the app.

Writing a post

Create content/YYYY-MM-DD-slug.md. Front matter is optional:

---
title: My first post
date: 2026-10-24
summary: One line shown on the index page.
draft: false
---

Post body in Markdown...
  • title — falls back to the first # heading, then the slug.
  • date — falls back to the date in the filename.
  • summary — shown on the index page.
  • draft: true — hides the post everywhere.

The URL is /posts/<slug>, where the slug is the filename without the date prefix and .md extension.

Posts go through the normal branch-and-PR flow; never push to main.

Pages

Route Page
/ All posts, newest first
/posts/<slug> One post, with previous/next links
/about Version, post count, and how to write a post
/feed.xml RSS feed (linked in the footer)
anything else 404 page

Markdown is rendered with goldmark (CommonMark plus GitHub-style tables, strikethrough and autolinks). Raw HTML in posts is not rendered.

Configuration

Site settings: content/site.json

Optional. Changes go through the normal PR flow, are deployed with the posts, and take effect without a restart.

{
  "homeText": "Home"
}
Setting Default Meaning
homeText Home Text of the header link to the index page

A missing file, a missing setting or a blank value uses the default. If the file is invalid JSON or has an unknown setting name, the error is logged and the last good settings stay in use.

Server settings

Environment variables (on the server, in /etc/goapps/posts.env):

Variable Default Meaning
PORT (required) Port to listen on, bound to 127.0.0.1
CONTENT_DIR content Directory holding the .md posts and site.json
SITE_URL https://posts.monoaf.com Absolute base URL used in the RSS feed

Development

go test ./...
PORT=8080 go run .

The About page text is about.md, built into the binary. The version shown there is the version constant in version.go; bump it in any PR that makes a user-visible change. The git commit is added automatically at build time.

Deployment

Runs as systemd unit goapp@posts on port 8002 behind nginx. Deploy with:

deploy-go posts --content

which builds and installs the binary and syncs content/ to /opt/apps/posts/content/.

License

MIT