Tip
Saga 3 is here! i18n, incremental builds, and more. See the migration guide for what's new.
A code-first static site generator in Swift. No config files, no implicit behavior, no magic conventions.
Your entire site pipeline is plain Swift code:
try await Saga(input: "content", output: "deploy")
.register(
folder: "articles",
metadata: ArticleMetadata.self,
readers: [.parsleyMarkdownReader],
writers: [
.itemWriter(swim(renderArticle)),
.listWriter(swim(renderArticles), paginate: 20),
.tagWriter(swim(renderTag), tags: \.metadata.tags),
]
)
.run()Typed metadata, pluggable readers, multiple writer types, pagination, tags — all defined in Swift, readable top to bottom, and enforced by the compiler. No hidden defaults. No template logic you can't debug.
Saga is for you if:
- You want your site generation logic in Swift, not YAML/TOML config files
- You want compile-time safety for your HTML templates and content metadata
- You've outgrown convention-based SSGs and want full control
Saga is not for you if:
- You need a large ecosystem of themes and templates
- You're not comfortable with Swift
| Feature | Saga | Hugo | Eleventy | Jekyll | Pelican | Astro | Publish | Ignite | Toucan |
|---|---|---|---|---|---|---|---|---|---|
| Language | Swift | Go | JS | Ruby | Python | TS | Swift | Swift | Swift |
| In development since | 2021 | 2013 | 2017 | 2008 | 2010 | 2021 | 2019 | 2024 | 2023 |
| CLI (init, dev, build) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ |
| Live reload | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ |
| Incremental builds | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ |
| Code over configuration | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✓ | ✗ | ✗ |
| Multiple typed content types | ✓ | ✗ | ✗ | ✗ | ✗ | ✓¹ | ✗ | ✗ | ✗ |
| Type-safe HTML templates | ✓ | ✗ | ✗ | ✗ | ✗ | ✓² | ✓ | ✓ | ✗ |
| Pagination | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✓ |
| Tags / taxonomies | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ | ✗ |
| i18n | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ | ✗ | ✗ | ✗ |
| Sitemap generation | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| RSS / Atom feeds | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Syntax highlighting | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ |
| Markdown attributes | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ |
| Programmatic content | ✓ | ✓ | ✓ | ✗ | ✗ | ✓ | ✗ | ✓⁴ | ✗ |
| Asset hashing | ✓ | ✓ | ✗ | ✗ | ✗ | ✓ | ✗ | ✗ | ✗ |
| Pre/Post build hooks | ✓ | ✗ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ |
| Shortcodes | ✓³ | ✓ | ✓ | ✓ | ✗ | ✓ | ✗ | ✗ | ✗ |
| Image processing | ✗ | ✓ | ✓ | ✗ | ✗ | ✓ | ✗ | ✗ | ✗ |
| Asset bundling | ✗ | ✓ | ✓ | ✗ | ✗ | ✓ | ✗ | ✗ | ✗ |
| Themes ecosystem | ✗ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ |
| Good documentation | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ |
¹ With Zod
² With JSX
³ With item processors
⁴ Via prepare() hook
Via Homebrew:
$ brew install loopwerk/tap/saga
Via Mint:
$ mint install loopwerk/saga-cli
From source:
$ git clone https://github.com/loopwerk/saga-cli.git
$ cd saga-cli
$ swift package experimental-install
This installs the saga binary to ~/.swiftpm/bin. Make sure that directory is in your PATH.
The fastest way to start a new site:
$ saga init mysite
$ cd mysite
$ saga dev
This scaffolds a complete project with articles, tags, templates, and a stylesheet — ready to build and serve.
For manual setup or more detail, see the installation guide.
Saga avoids hidden behavior entirely.
There are no default values to override, no magic conventions you have to learn, and no configuration files that quietly change how your site is built. Everything is strongly typed, from top to bottom, and you describe exactly how your site is generated using Swift code.
If something happens during a build, you can always point to the code that made it happen.
The example above shows a single content type, but Saga scales to handle complex sites with multiple content types.
Saga allows you to:
- Add strongly typed metadata to your content.
- Define multiple content types with different metadata.
- Build archive pages, tag pages, feeds, and indexes.
- Swap in different readers and renderers.
- Load content programmatically and/or from disk.
- Build multilingual sites with automatic translation linking and fully localized URLs.
- Register custom pipeline steps for logic outside the standard pipeline: generate images, build a search index, or run any custom logic as part of your build.
- Process the generated HTML content right before it's written to disk. For example to minify it.
- Easily created cache-busting hashed filenames for static assets.
- Create a sitemap with one line of code.
- Keep everything enforced by the compiler.
Saga's metadata system lets you define multiple content types, each with their own strongly typed metadata.
For example, a single site might include:
- Blog articles with tags and publication dates
- A project portfolio with App Store links and screenshots
- Movie reviews with ratings, actors, genres, and release years
Each content type can be indexed, paginated, or grouped independently.
Few static site generators can model diverse content like this while keeping everything type-safe. Saga can.
See the Example project for a complete site with articles, server-side syntax highlighting of code blocks, tags, pagination, an app portfolio, and RSS feeds.
Saga has built-in i18n support with fully localized URLs, automatic translation linking, and per-locale writers. See the i18n guide and the ExampleI18n project.
Full documentation covering installation, getting started, metadata modeling, and advanced usage is available:
- In Xcode via Product → Build Documentation
- Online at getsaga.dev/docs/
Saga is modular. You compose it with readers and renderers that fit your needs.
Please see GetSaga.dev for an overview, or browse the saga-plugin tag on GitHub.
Saga requires Swift 6.0+ and runs on macOS 14+ and Linux.
Is your website built with Saga? Send a pull request to add it to the list!
Commercial support is available via Loopwerk.
