Swiftpack.co - Package - SDGGiesbrecht/SDGWeb

macOS • Linux • iOS • watchOS • tvOS



SDGWeb provides tools for generating websites.

כְּשִׁמְךָ אֱלֹהִים כְּן תְּהלָּתְךָ עַל־קַצְוֵי־אֶרֶץ׃

Like your name, O God, your praise reaches to the ends of the earth.

―sons of קורח/Koraẖ


  • Sites are constructed from simple templates.
  • Customizable template processing in Swift.
  • Supports localized websites.

Example Usage

let mock = RepositoryStructure(
  root: URL(fileURLWithPath: #file)
    .appendingPathComponent("Mock Projects/\(mockName)")

let site = Site<L>(
  repositoryStructure: mock,
  domain: UserFacing<StrictString, L>({ _ in return "http://example.com" }),
  localizationDirectories: UserFacing<StrictString, L>({ localization in
    return localization.icon ?? StrictString(localization.code)
  pageProcessor: Processor(),
  reportProgress: { _ in }

try site.generate().get()
let warnings = site.validate()


SDGWeb provides libraries for use with the Swift Package Manager.

Simply add SDGWeb as a dependency in Package.swift and specify which of the libraries to use:

let package = Package(
    name: "MyPackage",
    dependencies: [
        .package(url: "https://github.com/SDGGiesbrecht/SDGWeb", from: Version(4, 0, 1)),
    targets: [
        .target(name: "MyTarget", dependencies: [
            .productItem(name: "SDGWeb", package: "SDGWeb"),
            .productItem(name: "SDGHTML", package: "SDGWeb"),
            .productItem(name: "SDGCSS", package: "SDGWeb"),

The modules can then be imported in source files:

import SDGWeb
import SDGHTML
import SDGCSS


The SDGWeb project is maintained by Jeremy David Giesbrecht.

If SDGWeb saves you money, consider giving some of it as a donation.

If SDGWeb saves you time, consider devoting some of it to contributing back to the project.

Ἄξιος γὰρ ὁ ἐργάτης τοῦ μισθοῦ αὐτοῦ ἐστι.

For the worker is worthy of his wages.



Stars: 1
Help us keep the lights on



4.0.1 - Dec 1, 2019

Dependency updates.

4.0.0 - Oct 19, 2019

Breaking Changes

  • ElementSyntax.name has been changed to nameText, and name now refers to the TokenSyntax instead of the String.

New Features

  • Syntax nodes have more convenience methods and properties.
  • Consistent formatting can be applied to syntax nodes with format().
    • Formatting is applied by default during site generation. It can be disabled by setting the new parameter of generate(formatting:) to false.

Bug Fixes

  • Validation now flags heading levels that are skipped. (Such as having an h5 without an h4.)

3.1.0 - Oct 2, 2019

New Features

  • All platform restrictions have been removed.

3.0.0 - Sep 22, 2019

Breaking Changes

  • Swift 5.1
  • The older ContentSyntax and its child list node have been collapsed into a single list node.
    • The freed‐up, shorter name has been reused as the new name for ContentElementSyntax.

New Features

  • Many convenience methods and initializers have been added to syntax nodes.

2.0.1 - Aug 26, 2019

Bug Fixes

  • Validation recognizes data- attributes.