mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-12-22 04:13:17 -06:00
Select summary or summary_large_image in twitter card with image size
This commit is contained in:
parent
a01a70fc91
commit
d9776d29c4
@ -5,11 +5,23 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with $featured }}
|
{{ with $featured }}
|
||||||
<meta name="twitter:card" content="summary">
|
{{ $ratio := 0 }}
|
||||||
|
{{ if gt .Width .Height }}
|
||||||
|
{{ $ratio = div (float .Width) .Height }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $ratio = div (float .Height) .Width }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if lt $ratio 1.75 }}
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
{{ else }}
|
||||||
|
<meta name="twitter:card" content="summary">
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<meta name="twitter:image" content="{{ $featured.Permalink }}">
|
<meta name="twitter:image" content="{{ $featured.Permalink }}">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<meta name="twitter:title" content="{{ .Title }}">
|
<meta name="twitter:title" content="{{ .Title | plainify }}">
|
||||||
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
|
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
|
||||||
|
|
||||||
{{ with .Site.Social.twitter }}
|
{{ with .Site.Social.twitter }}
|
||||||
|
Loading…
Reference in New Issue
Block a user