A static site generator written in Swift

What's New

Release 1.2.1


Documentation Changes

  • Updated docs to remove the site metadata which is no longer a thing


  • Fixed tests


A static site generator, written in Swift, allowing you to supply your own metadata types for your items. Saga uses a system of extendible readers, renderers, and writers, supporting things like Atom feeds, paginating, and strongly typed HTML templates.

Saga is quite flexible: for example you can have one set of metadata for the articles on your blog, and another set of metadata for the apps in your portfolio. At the same time it's quite easy to configure.

Note: Saga uses async/await and as such requires at least Swift 5.5 and macOS 12 (or Linux). Version 0.22.0 can be used on macOS 11 with Swift 5.2.


func renderPage(context: ItemRenderingContext<EmptyMetadata>) -> Node {
  html(lang: "en-US") {
    body {
      div(id: "content") {
        h1 { context.item.title }

struct Run {
  static func main() async throws {
    try await Saga(input: "content", output: "deploy")
      // All files will be parsed to html.
        metadata: EmptyMetadata.self,
        readers: [.parsleyMarkdownReader()],
        writers: [

      // Run the step we registered above

      // All the remaining files that were not parsed to markdown, so for example images, raw html files and css,
      // are copied as-is to the output folder.

That example uses Swim to create type-safe HTML.

Of course Saga can do much more than just render a folder of Markdown files as-is. It can also deal with custom metadata contained within Markdown files - even multiple types of metadata for different kinds of pages.


Please refer to the documentation for installation instructions, system requirements, basic getting started information, and how-to's for more advanced things.

The documentation is available from within Xcode (Product > Build Documentation) or at

Websites using Saga

Is your website built with Saga? Send a pull request to add it to this list!


  • Swift Tools 5.5.0
View More Packages from this Author


Last updated: Sun Jun 09 2024 22:52:44 GMT-0900 (Hawaii-Aleutian Daylight Time)