|
| 1 | +{{/* Build absolute image URL explicitly so OG image works with baseURL subpath (e.g. /blog/). */}} |
| 2 | +{{ $base := strings.TrimSuffix "/" .Site.BaseURL }} |
| 3 | + |
| 4 | +{{ $ogImage := "" }} |
| 5 | +{{ $description := "" }} |
| 6 | + |
| 7 | +{{ if .IsPage }} |
| 8 | + {{ with .Description }}{{ $description = . }}{{ end }} |
| 9 | + {{ if not $description }}{{ $description = .Summary | plainify | truncate 200 }}{{ end }} |
| 10 | + {{ if .Params.socialImage }} |
| 11 | + {{ $img := .Params.socialImage }} |
| 12 | + {{ $ogImage = cond (hasPrefix $img "http") $img (printf "%s/%s" $base $img) }} |
| 13 | + {{ else if .Params.featuredImage }} |
| 14 | + {{ $img := .Params.featuredImage }} |
| 15 | + {{ $ogImage = cond (hasPrefix $img "http") $img (printf "%s/%s" $base $img) }} |
| 16 | + {{ else }} |
| 17 | + {{ $img := .Site.Params.heroImage | default "images/og-image.png" }} |
| 18 | + {{ $ogImage = cond (hasPrefix $img "http") $img (printf "%s/%s" $base $img) }} |
| 19 | + {{ end }} |
| 20 | +{{ else }} |
| 21 | + {{ $description = .Site.Params.description | default .Site.Params.subtitle | default "El blog de quienes dan soporte - Sysarmy" }} |
| 22 | + {{ $img := .Site.Params.heroImage | default "images/og-image.png" }} |
| 23 | + {{ $ogImage = cond (hasPrefix $img "http") $img (printf "%s/%s" $base $img) }} |
| 24 | +{{ end }} |
| 25 | + |
| 26 | +{{ with $description }}<meta name="description" content="{{ . }}">{{ end }} |
| 27 | +<meta name="keywords" content="{{ if .Params.Keywords }}{{ delimit .Params.Keywords ", " }}{{ else if isset .Params "tags" }}{{ range .Params.tags }}{{ . }}, {{ end }}{{ else }}{{ $.Site.Params.Keywords }}{{ end }}"> |
| 28 | + |
| 29 | +<meta name="author" content="sysarmy"> |
| 30 | +<meta property="fb:admins" content="ajolo" /> |
| 31 | +<meta name="twitter:card" content="summary_large_image"> |
| 32 | +<meta name="twitter:site" content="@sysarmy"> |
| 33 | +<meta name="twitter:creator" content="@sysarmy"> |
| 34 | + |
| 35 | +{{ if .IsPage }} |
| 36 | + <meta property="og:title" content="El blog de quienes dan soporte - Sysarmy"> |
| 37 | + <meta property="twitter:title" content="El blog de quienes dan soporte - Sysarmy"> |
| 38 | + <meta property="og:type" content="article"> |
| 39 | + <meta property="article:published_time" content="{{ .Date.Format "2006-01-02" }}"> |
| 40 | + <meta property="og:description" content="{{ .Title }}"> |
| 41 | + <meta property="twitter:description" content="{{ .Title }}"> |
| 42 | + <meta name="description" content="{{ $description }}"> |
| 43 | +{{ else }} |
| 44 | + <meta property="og:title" content="{{ .Site.Title }}{{ with .Site.Params.Subtitle }} — {{ . }}{{ end }}"> |
| 45 | + <meta property="twitter:title" content="{{ .Site.Title }}"> |
| 46 | + <meta property="og:type" content="website"> |
| 47 | + <meta property="og:description" content="{{ $description }}"> |
| 48 | + <meta property="twitter:description" content="{{ $description }}"> |
| 49 | + <meta name="description" content="{{ $description }}"> |
| 50 | +{{ end }} |
| 51 | + |
| 52 | +<meta property="og:url" content="{{ .Permalink }}"> |
| 53 | +<meta property="og:site_name" content="sysarmy"> |
| 54 | +<meta property="og:image" content="{{ $ogImage }}"> |
| 55 | +<meta name="twitter:image" content="{{ $ogImage }}"> |
| 56 | +<meta name="twitter:image:src" content="{{ $ogImage }}"> |
| 57 | +<meta property="og:image:alt" content="{{ if .IsPage }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}"> |
| 58 | + |
| 59 | +{{ if .Params.tags }} |
| 60 | + {{ range .Params.tags }} |
| 61 | + <meta property="og:tags" content="{{ . }}"> |
| 62 | + {{ end }} |
| 63 | +{{ end }} |
0 commit comments