twitter-card-metas.html (1471B)
1 <meta name="twitter:card" content="{{ cond (or (isset .Params.Twitter "image") (isset .Params.Image "src")) "summary_large_image" "summary"}}"> 2 {{ $titleHome := (printf "%s :: %s" .Site.Title .Site.Params.Author) }} 3 {{ $titleRest := (printf "%s %s %s" (cond (eq .Type "notes") .Site.Title .Title) (cond (eq .Type "notes") "wrote" "::") (cond (eq .Type "notes") "a note:" .Site.Title) ) }} 4 {{ $defaultDesc := cond (isset .Params "description") .Description (printf "%s by %s" .Site.Params.Description .Site.Params.Author) }} 5 {{ $dateformat := .Params.Date.Format "2006-01-02 15:04" }} 6 {{ $idslug := (print "date-" $dateformat "-") | urlize }} 7 {{ $lastUrlElement := index (last 1 (split (delimit (split .RelPermalink "/") "," "") ",")) 0 }} 8 9 <meta name="twitter:title" content="{{ cond .IsHome $titleHome $titleRest }}"> 10 <meta name="twitter:url" content="{{ cond (eq .Type "notes") ( (print .Site.BaseURL "notes#" $idslug)) .Permalink }}"> 11 <meta name="twitter:description" content="{{ cond .IsHome .Site.Params.Description (cond (and (eq .Type "notes") (ne .Summary "")) .Summary $defaultDesc) }}"> 12 <meta name="twitter:image" content="{{ (cond (isset .Params.Image "src") (printf "%s%s" .Permalink .Params.Image.Src) nil) | default "logo.png" | absURL }}"> 13 <meta name="twitter:image:alt" content="{{ cond .IsHome $titleHome $titleRest }}"> 14 <meta name="twitter:site" content="@{{ .Site.Params.twitter }}"> 15 <meta name="twitter:creator" content="@{{ .Site.Params.twitter }}">