diff --git a/public/.htaccess b/public/.htaccess index dee4603..9b3e429 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -6,6 +6,10 @@ AddType text/html net SetOutputFilter DEFLATE AddDefaultCharset utf-8 + + AddType application/feed+json json + + # Turn on Expires and set default expires to 3 days ExpiresActive On ExpiresDefault A259200 @@ -18,7 +22,7 @@ ExpiresDefault A259200 # Set up 2 week caching on commonly updated files - + ExpiresDefault A1209600 Header append Cache-Control "private, must-revalidate" diff --git a/samhuri.net/Sources/samhuri.net/Files/Permissions.swift b/samhuri.net/Sources/samhuri.net/Files/Permissions.swift index c88fbf1..2375189 100644 --- a/samhuri.net/Sources/samhuri.net/Files/Permissions.swift +++ b/samhuri.net/Sources/samhuri.net/Files/Permissions.swift @@ -10,7 +10,7 @@ import Foundation struct Permissions: OptionSet { let rawValue: Int16 - static let none = Permissions(rawValue: 0) + static let none: Permissions = [] // These raw values match those used by Unix file systems and must not be changed. diff --git a/samhuri.net/Sources/samhuri.net/Posts/JSONFeed/JSONFeedWriter.swift b/samhuri.net/Sources/samhuri.net/Posts/JSONFeed/JSONFeedWriter.swift index 6dada83..0a2b8cb 100644 --- a/samhuri.net/Sources/samhuri.net/Posts/JSONFeed/JSONFeedWriter.swift +++ b/samhuri.net/Sources/samhuri.net/Posts/JSONFeed/JSONFeedWriter.swift @@ -37,15 +37,17 @@ final class JSONFeedWriter { private extension JSONFeedWriter { func buildFeed(site: Site, posts: [Post], renderer: JSONFeedRendering) throws -> Feed { - Feed( + let author = FeedAuthor( + name: site.author, + avatar: jsonFeed.avatarPath.map(site.url.appendingPathComponent)?.absoluteString, + url: site.url.absoluteString + ) + return Feed( title: site.title, home_page_url: site.url.absoluteString, feed_url: site.url.appendingPathComponent(jsonFeed.path).absoluteString, - author: FeedAuthor( - name: site.author, - avatar: jsonFeed.avatarPath.map(site.url.appendingPathComponent)?.absoluteString, - url: site.url.absoluteString - ), + author: author, + authors: [author], icon: jsonFeed.iconPath.map(site.url.appendingPathComponent)?.absoluteString, favicon: jsonFeed.faviconPath.map(site.url.appendingPathComponent)?.absoluteString, items: try posts.map { post in @@ -66,11 +68,17 @@ private extension JSONFeedWriter { } private struct Feed: Codable { - let version = "https://jsonfeed.org/version/1" + var version = "https://jsonfeed.org/version/1.1" + var language = "en-CA" let title: String let home_page_url: String let feed_url: String + + // `author` has been deprecated in favour of `authors`, but `author` remains for backwards + // compatibility. let author: FeedAuthor + let authors: [FeedAuthor] + let icon: String? let favicon: String? let items: [FeedItem]