diff --git a/Packages/Infrastructure/Sources/Public/Types/StructuredData.swift b/Packages/Infrastructure/Sources/Public/Types/StructuredData.swift index 38d0acd..8ffb15b 100644 --- a/Packages/Infrastructure/Sources/Public/Types/StructuredData.swift +++ b/Packages/Infrastructure/Sources/Public/Types/StructuredData.swift @@ -65,6 +65,7 @@ public extension StructuredData { /// - areaServed: the area the organization serves, or `nil` (the default) to omit its property. /// - email: the address the organization is written to, or `nil` (the default) to omit its property. /// - logo: the absolute URL of the organization's logo, or `nil` (the default) to omit its property. + /// - inLanguage: the language codes the site is published in; empty (the default) to omit the property. /// - profiles: the absolute URLs of the organization's public profiles, or empty (the default) to omit their property. /// - founder: the `@id` of the `Person` node founding the organization, or `nil` (the default) to omit its property. init( @@ -75,6 +76,7 @@ public extension StructuredData { areaServed: String? = nil, email: String? = nil, logo: String? = nil, + inLanguage: [String] = [], profiles: [String] = [], founder: String? = nil ) { @@ -116,6 +118,19 @@ public extension StructuredData { organization.append(.init(.founder, value: .reference(founder))) } + var website: [Property] = [ + .init(.name, value: .string(name)), + .init(.url, value: .string(url)), + .init(.publisher, value: .reference(id)), + ] + + if !inLanguage.isEmpty { + website.append(.init( + .inLanguage, + value: .array(inLanguage.map(Value.string)) + )) + } + self.init(nodes: [ .init( type: .organization, @@ -124,11 +139,7 @@ public extension StructuredData { ), .init( type: .website, - properties: [ - .init(.name, value: .string(name)), - .init(.url, value: .string(url)), - .init(.publisher, value: .reference(id)), - ] + properties: website ), ]) } diff --git a/Packages/Infrastructure/Sources/Public/Types/StructuredData/StructuredDataProperty.swift b/Packages/Infrastructure/Sources/Public/Types/StructuredData/StructuredDataProperty.swift index b311bdb..6ef5c1d 100644 --- a/Packages/Infrastructure/Sources/Public/Types/StructuredData/StructuredDataProperty.swift +++ b/Packages/Infrastructure/Sources/Public/Types/StructuredData/StructuredDataProperty.swift @@ -79,6 +79,8 @@ public extension StructuredData.Property.Name { static let email: Self = "email" /// The person who founded an organization. static let founder: Self = "founder" + /// The language a creative work — a site, a page — is published in. + static let inLanguage: Self = "inLanguage" /// The absolute URL of an organization's logo. static let logo: Self = "logo" /// The name of the thing a node describes.