Finish twitter app card data.

This commit is contained in:
Dillon Kearns 2019-08-05 09:00:53 -07:00
parent af48f9a414
commit 7ed754ab53

View File

@ -29,6 +29,30 @@ summaryLarge details =
|> tags |> tags
{-| <https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/app-card>
-}
app :
{ title : String
, description : Maybe String
, siteUser : String
, image : Maybe { url : String, alt : String }
, appIdIphone : Maybe Int
, appIdIpad : Maybe Int
, appIdGooglePlay : Maybe String
, appUrlIphone : Maybe String
, appUrlIpad : Maybe String
, appUrlGooglePlay : Maybe String
, appCountry : Maybe String
, appNameIphone : Maybe String
, appNameIpad : Maybe String
, appNameGooglePlay : Maybe String
}
-> List Head.Tag
app details =
App details
|> tags
ensureAtPrefix : String -> String ensureAtPrefix : String -> String
ensureAtPrefix twitterUsername = ensureAtPrefix twitterUsername =
if twitterUsername |> String.startsWith "@" then if twitterUsername |> String.startsWith "@" then
@ -51,19 +75,21 @@ type TwitterCard
, image : Maybe { url : String, alt : String } , image : Maybe { url : String, alt : String }
, size : SummarySize , size : SummarySize
} }
-- https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/app-card
| App | App
{ title : String { title : String
, description : Maybe String , description : Maybe String
, siteUser : String , siteUser : String
, image : Maybe { url : String, alt : String } , image : Maybe { url : String, alt : String }
, appIdIphone : Int , appIdIphone : Maybe Int
, appIdIpad : Int , appIdIpad : Maybe Int
, appIdGooglePlay : String , appIdGooglePlay : Maybe String
, appUrlIphone : Maybe String , appUrlIphone : Maybe String
, appUrlIpad : Maybe String , appUrlIpad : Maybe String
, appUrlGooglePlay : Maybe String , appUrlGooglePlay : Maybe String
, appCountry : Maybe String , appCountry : Maybe String
, appNameIphone : Maybe String
, appNameIpad : Maybe String
, appNameGooglePlay : Maybe String
} }
-- https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/player-card -- https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/player-card
| Player | Player
@ -95,6 +121,16 @@ tags card =
, ( "twitter:description", details.description ) , ( "twitter:description", details.description )
, ( "twitter:image", details.image |> Maybe.map .url ) , ( "twitter:image", details.image |> Maybe.map .url )
, ( "twitter:image:alt", details.image |> Maybe.map .alt ) , ( "twitter:image:alt", details.image |> Maybe.map .alt )
, ( "twitter:app:name:iphone", details.appNameIphone )
, ( "twitter:app:name:ipad", details.appNameIpad )
, ( "twitter:app:name:googleplay", details.appNameGooglePlay )
, ( "twitter:app:id:iphone", details.appIdIphone |> Maybe.map String.fromInt )
, ( "twitter:app:id:ipad", details.appIdIpad |> Maybe.map String.fromInt )
, ( "twitter:app:id:googleplay", details.appIdGooglePlay )
, ( "twitter:app:url:iphone", details.appUrlIphone )
, ( "twitter:app:url:ipad", details.appUrlIpad )
, ( "twitter:app:url:googleplay", details.appUrlGooglePlay )
, ( "twitter:app:country", details.appCountry )
] ]
Player details -> Player details ->