Added the site languages to the Structured Data in the Infrastructure package.

This commit is contained in:
2026-09-04 14:43:06 +02:00
parent 0b3ef2890e
commit a9a62e10df
2 changed files with 18 additions and 5 deletions
@@ -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
),
])
}
@@ -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.