From 8dbe87d370de17b2ee78006d73904057c7936c9e Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Mon, 9 Sep 2019 20:10:27 -0700 Subject: [PATCH] Add profile helper for SEO for og:profile. --- elm-package/src/Head/Seo.elm | 26 ++++++++++++++++++++++++++ site/src/Metadata.elm | 1 - 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/elm-package/src/Head/Seo.elm b/elm-package/src/Head/Seo.elm index 8bceccde..c43e09d7 100644 --- a/elm-package/src/Head/Seo.elm +++ b/elm-package/src/Head/Seo.elm @@ -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 +-} +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 + } {-| @@ -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 ) -> diff --git a/site/src/Metadata.elm b/site/src/Metadata.elm index 44043a46..10992751 100644 --- a/site/src/Metadata.elm +++ b/site/src/Metadata.elm @@ -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