The old version was a pile of Markdown files glued together with a templating helper. It worked, but every new feature meant more glue: project devlogs, tags, search. So I set four goals and started over.

Goals

  1. One source format: Neorg
  2. One binary to deploy
  3. Projects as folders, not flat files
  4. Search that knows a post from a project

Loading pipeline

The loader walks content/projects/<slug>/ and treats index.norg as the project entry point. Every other .norg file in the folder becomes a devlog.

Go
func LoadProjects(dir string) ([]Project, error) {
    folders, err := os.ReadDir(dir)
    if err != nil {
        if os.IsNotExist(err) {
            return []Project{}, nil
        }
        return nil, fmt.Errorf("read projects dir: %w", err)
    }
    // ... walk folders, load index.norg, then siblings
}

A missing projects folder returns an empty list. Anything else that goes wrong returns an error, and the app refuses to start. I would rather see a broken file at boot than serve half a site.

Routing trick

Go's net/http ServeMux picks the longest matching pattern. Registering both /projects (exact) and /projects/ (prefix) lets one handler family serve three URL shapes:

URLHandler
/projectsindex
projects{slug}project detail
projects{slug}/{post}devlog detail

The rule I kept

Parse once at startup, then answer every request from memory. No database, no cache to invalidate, nothing that changes between deploys.

The next devlog covers the devlog grid and the nested routes.