Images sociales
This commit is contained in:
@@ -39,17 +39,33 @@
|
||||
{{- $alt = printf "Logo du site %s" site.Title -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $data := dict -}}
|
||||
{{- if $image -}}
|
||||
{{- $isInterestingLink := and $isCoverImage (strings.HasPrefix .RelPermalink "/interets/liens-interessants/") -}}
|
||||
{{- $shouldBlur := $isInterestingLink -}}
|
||||
{{- $cropAnchor := "Center" -}}
|
||||
{{- if $isInterestingLink -}}
|
||||
{{- $cropAnchor = "Top" -}}
|
||||
{{- end -}}
|
||||
{{- $alt = $alt | strings.TrimSpace | truncate 420 -}}
|
||||
{{- $data = dict
|
||||
"url" $image.Permalink
|
||||
"alt" ($alt | strings.TrimSpace | truncate 420)
|
||||
"openGraph" (partial "head/social-image-variant.html" (dict
|
||||
"image" $image
|
||||
"width" 1200
|
||||
"height" 630
|
||||
"anchor" $cropAnchor
|
||||
"alt" $alt
|
||||
"blur" $shouldBlur
|
||||
))
|
||||
"twitter" (partial "head/social-image-variant.html" (dict
|
||||
"image" $image
|
||||
"width" 1200
|
||||
"height" 1200
|
||||
"anchor" $cropAnchor
|
||||
"alt" $alt
|
||||
"blur" $shouldBlur
|
||||
))
|
||||
-}}
|
||||
{{- with $image.Width -}}
|
||||
{{- $data = merge $data (dict "width" .) -}}
|
||||
{{- end -}}
|
||||
{{- with $image.Height -}}
|
||||
{{- $data = merge $data (dict "height" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $data -}}
|
||||
|
||||
Reference in New Issue
Block a user