File tree Expand file tree Collapse file tree 1 file changed +31
-2
lines changed Expand file tree Collapse file tree 1 file changed +31
-2
lines changed Original file line number Diff line number Diff line change 44< meta name ="description " content ="{{ $params.description | default .Site.Params.description }} ">
55
66{{- if ne $offline true -}}
7- {{ partial "opengraph.html" . }}
8- {{- template "_internal/twitter_cards.html" . -}}
7+ {{- $og := partial "opengraph.html" . -}}
8+ {{- $twitter := partial "twitter_cards.html" . -}}
9+ {{- $image := "" -}}
10+ {{- with .Params.featuredImage -}}
11+ {{- $original := resources.Get . -}}
12+ {{- with $original }}
13+ {{- $processed := .Fit "800x450 Lanczos" -}}
14+ {{- $image = $processed.Permalink -}}
15+ {{- end -}}
16+ {{- else -}}
17+ {{- with .Resources.GetMatch "featured-image" -}}
18+ {{- $processed := .Fit "800x450 Lanczos" -}}
19+ {{- $image = $processed.Permalink -}}
20+ {{- else -}}
21+ {{- range .Params.resources -}}
22+ {{- if eq .name "featured-image" -}}
23+ {{- $original := resources.Get .src -}}
24+ {{- with $original }}
25+ {{- $processed := .Fit "800x450 Lanczos" -}}
26+ {{- $image = $processed.Permalink -}}
27+ {{- end -}}
28+ {{- end -}}
29+ {{- end -}}
30+ {{- end -}}
31+ {{- end -}}
32+ {{- if $image }}
33+ {{- $og = replaceRE `< meta property ="og:image " content ="[^ "]* "> ` (printf `< meta property ="og:image " content ="%s "> ` $image) $og -}}
34+ {{- $twitter = replaceRE `< meta name ="twitter:image " content ="[^ "]* "> ` (printf `< meta name ="twitter:image " content ="%s "> ` $image) $twitter -}}
35+ {{- end -}}
36+ {{- $og | safeHTML -}}
37+ {{- $twitter | safeHTML -}}
938{{- end -}}
1039
1140< meta name ="application-name " content ="{{ .Site.Params.app.title | default .Site.Title }} ">
You can’t perform that action at this time.
0 commit comments