Add profile helper for SEO for og:profile.

This commit is contained in:
Dillon Kearns 2019-09-09 20:10:27 -07:00
parent 9853ed206f
commit 8dbe87d370
2 changed files with 26 additions and 1 deletions

View File

@ -2,6 +2,7 @@ module Head.Seo exposing
( Image
, article
, audioPlayer
, profile
, song
, summary
, summaryLarge
@ -221,6 +222,19 @@ book common details =
Book details |> Content common |> tags
{-| See <https://ogp.me/#type_profile>
-}
profile :
{ firstName : String
, lastName : String
, username : Maybe String
}
-> Common pathKey
-> List (Head.Tag pathKey)
profile details common =
Profile details |> Content common |> tags
song :
Common pathKey
->
@ -333,6 +347,11 @@ type ContentDetails
, disc : Maybe Int
, track : Maybe Int
}
| Profile
{ firstName : String
, lastName : String
, username : Maybe String
}
{-| <https://en.wikipedia.org/wiki/ISO_8601>
@ -425,6 +444,13 @@ tags (Content common details) =
, ( "music:album:disc", songDetails.disc |> Maybe.map String.fromInt |> Maybe.map Head.raw )
, ( "music:album:track", songDetails.track |> Maybe.map String.fromInt |> Maybe.map Head.raw )
]
Profile profileDetails ->
[ ( "og:type", "profile" |> Head.raw |> Just )
, ( "profile:first_name", profileDetails.firstName |> Head.raw |> Just )
, ( "profile:last_name", profileDetails.lastName |> Head.raw |> Just )
, ( "profile:username", profileDetails.username |> Maybe.map Head.raw )
]
)
|> List.filterMap
(\( name, maybeContent ) ->

View File

@ -4,7 +4,6 @@ import Dict exposing (Dict)
import Element exposing (Element)
import Element.Font as Font
import Mark
import Pages.Parser
type Metadata msg