diff --git a/examples/docs/src/Main.elm b/examples/docs/src/Main.elm index 2fe2c1f9..6bef2659 100644 --- a/examples/docs/src/Main.elm +++ b/examples/docs/src/Main.elm @@ -550,7 +550,7 @@ head currentPath metadata = { title = meta.title , description = meta.description , author = meta.author.name - , publisher = "elm-pages blog" + , publisher = StructuredData.person { name = "Dillon Kearns" } , url = canonicalSiteUrl ++ "/" ++ PagePath.toString currentPath , imageUrl = canonicalSiteUrl ++ "/" ++ ImagePath.toString meta.image , datePublished = Date.toIsoString meta.published diff --git a/src/StructuredData.elm b/src/StructuredData.elm index c35e5b39..ff56331c 100644 --- a/src/StructuredData.elm +++ b/src/StructuredData.elm @@ -22,6 +22,16 @@ softwareSourceCode info = ] +{-| +-} +person : { name : String } -> Encode.Value +person info = + Encode.object + [ ( "@type", Encode.string "Person" ) + , ( "name", Encode.string info.name ) + ] + + {-| -} computerLanguage : { url : String, name : String, imageUrl : String, identifier : String } -> Encode.Value @@ -51,7 +61,7 @@ article : { title : String , description : String , author : String - , publisher : String + , publisher : Encode.Value , url : String , imageUrl : String , datePublished : String @@ -66,7 +76,7 @@ article info = , ( "description", Encode.string info.description ) , ( "image", Encode.string info.imageUrl ) , ( "author", Encode.string info.author ) - , ( "publisher", Encode.string info.publisher ) + , ( "publisher", info.publisher ) , ( "url", Encode.string info.url ) , ( "datePublished", Encode.string info.datePublished ) , ( "mainEntityOfPage", info.mainEntityOfPage )