Project updates from Template #1
@@ -65,6 +65,7 @@ public extension StructuredData {
|
|||||||
/// - areaServed: the area the organization serves, or `nil` (the default) to omit its property.
|
/// - 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.
|
/// - 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.
|
/// - 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.
|
/// - 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.
|
/// - founder: the `@id` of the `Person` node founding the organization, or `nil` (the default) to omit its property.
|
||||||
init(
|
init(
|
||||||
@@ -75,6 +76,7 @@ public extension StructuredData {
|
|||||||
areaServed: String? = nil,
|
areaServed: String? = nil,
|
||||||
email: String? = nil,
|
email: String? = nil,
|
||||||
logo: String? = nil,
|
logo: String? = nil,
|
||||||
|
inLanguage: [String] = [],
|
||||||
profiles: [String] = [],
|
profiles: [String] = [],
|
||||||
founder: String? = nil
|
founder: String? = nil
|
||||||
) {
|
) {
|
||||||
@@ -116,6 +118,19 @@ public extension StructuredData {
|
|||||||
organization.append(.init(.founder, value: .reference(founder)))
|
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: [
|
self.init(nodes: [
|
||||||
.init(
|
.init(
|
||||||
type: .organization,
|
type: .organization,
|
||||||
@@ -124,11 +139,7 @@ public extension StructuredData {
|
|||||||
),
|
),
|
||||||
.init(
|
.init(
|
||||||
type: .website,
|
type: .website,
|
||||||
properties: [
|
properties: website
|
||||||
.init(.name, value: .string(name)),
|
|
||||||
.init(.url, value: .string(url)),
|
|
||||||
.init(.publisher, value: .reference(id)),
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -79,6 +79,8 @@ public extension StructuredData.Property.Name {
|
|||||||
static let email: Self = "email"
|
static let email: Self = "email"
|
||||||
/// The person who founded an organization.
|
/// The person who founded an organization.
|
||||||
static let founder: Self = "founder"
|
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.
|
/// The absolute URL of an organization's logo.
|
||||||
static let logo: Self = "logo"
|
static let logo: Self = "logo"
|
||||||
/// The name of the thing a node describes.
|
/// The name of the thing a node describes.
|
||||||
|
|||||||
Reference in New Issue
Block a user