Projects
avatar

Projects

AlchemyPub

Overview

AlchemyPub is the static site generator powering this site, built with Elixir & Phoenix LiveView. The source code is free and open source and available on Codeberg.

How it works

As a static site generator, AlchemyPub generates websites from markdown files. Changes to the source files on the file system are instantly compiled and published to all viewers. If no JavaScript is available on the client, it falls back gracefully to fully server-side rendered content. There is also an RSS feed generated from the articles.

Instead of saving generated pages as static html files, like many other SSGs do it, they are rendered on startup and stored in memory using ETS. A file watcher picks up changes and broadcasts them using PubSub. Using the magic of Phoenix LiveView the change is immediately propagated to all page visitors, even without refreshing a page.

With LiveDeck, AlchemyPub comes with an interactive presentation framework. It can turn any markdown page into a dynamic, interactive presentation. You can explore a demo of its capabilities here.

Dependencies

As a markdown parser, Earmark is used because of its possibilities to add custom transformers. This way, [[Wikilinks]]-style references are resolved and anchors are automatically generated for headers.

For styling, daisyUI allows easy change of themes and creation of your own style using Tailwind. The site is fully responsive for mobile and desktop resolutions, and supports themes for dark and light mode. Code blocks are automatically highlighted using highlight.js.

Page visits are tracked anonymously. Thanks to Phoenix Presence, it can keep track of navigation and the duration of each page visit. This also powers the live online counter in the navigation bar. The tracking data is stored in a file based SQLite database using Ecto. No external database or configuration is required. The tracking data can be viewed through the Phoenix LiveDashboard.

Contributing

If you found a bug or want to contribute otherwise, please open an issue or pull request on Codeberg.