Migrating to Saga 4
Saga 4 adds item resources, and removes the APIs that were deprecated in Saga 3.
What’s new
- Item resources. Files next to an item, such as images, are available as
resources. See Item resources.
Breaking changes
Important These changes will require updates to your code.
metadata:is required. Saga’s default for this parameter relies on behavior that a future Swift language mode will turn into an error, so everyregistercall now needs an explicitmetadata:argument. PassEmptyMetadata.selfwhere you relied on the default.ItemRenderingContext.resourcesis removed. Usecontext.item.resourcesinstead. Each resource is aResourcerather than a path, so link to it with itsurl.- With i18n,
hashed(_:now takes the file’s path in the output folder rather than the input folder. For example) /articles/chart.pngrather than/en/articles/chart.png, or/nl/artikelen/chart.pngrather than/nl/articles/chart.png. Files outside locale folders, like/static/style.css, are unaffected. - Deprecated APIs are removed:
ignore(_:: use) ignoreChanges(_:.) register(write:: use) afterRead(_:or) afterWrite(_:.) sitemap(baseURL:with afilter: ) (Path) -> Boolfilter: usesitemap(baseURL:, whose filter also receives the item,filter: ) (Path, AnyItem?) -> Bool.atomFeed(…, dateKeyPath:: use) atomFeed(title:, which takes a closure or a key path likeauthor: baseURL: limit: itemTitle: summary: image: date: ) \.date.
Update your dependencies
In your Package.swift, bump the Saga dependency:
// Before
.package(url: "https://github.com/loopwerk/Saga", from: "3.0.0"),
// After
.package(url: "https://github.com/loopwerk/Saga", from: "4.0.0"),