mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-12-21 10:02:17 +01:00
Import Hugo's Twitter cards partial from tpl/template_embedded.go
I want to see if I can improve the metadata here.
This commit is contained in:
parent
527bc0d824
commit
a709b3b6a2
@ -2,7 +2,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
{{ partial "opengraph.html" . }}
|
{{ partial "opengraph.html" . }}
|
||||||
{{ template "_internal/twitter_cards.html" . }}
|
{{ partial "twitter_cards.html" . }}
|
||||||
|
|
||||||
{{- with .Site.Params.google_verify_meta -}}
|
{{- with .Site.Params.google_verify_meta -}}
|
||||||
<meta name="google-site-verification" content="{{ . }}" />
|
<meta name="google-site-verification" content="{{ . }}" />
|
||||||
|
17
layouts/partials/twitter_cards.html
Normal file
17
layouts/partials/twitter_cards.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{ if .IsPage }}
|
||||||
|
{{ with .Params.images }}
|
||||||
|
<!-- Twitter summary card with large image must be at least 280x150px -->
|
||||||
|
<meta name="twitter:card" content="summary_large_image"/>
|
||||||
|
<meta name="twitter:image:src" content="{{ index . 0 | absURL }}"/>
|
||||||
|
{{ else }}
|
||||||
|
<meta name="twitter:card" content="summary"/>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<!-- Twitter Card data -->
|
||||||
|
<meta name="twitter:title" content="{{ .Title }}"/>
|
||||||
|
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"/>
|
||||||
|
{{ with .Site.Social.twitter }}<meta name="twitter:site" content="@{{ . }}"/>{{ end }}
|
||||||
|
{{ with .Site.Social.twitter_domain }}<meta name="twitter:domain" content="{{ . }}"/>{{ end }}
|
||||||
|
{{ range .Site.Authors }}
|
||||||
|
{{ with .twitter }}<meta name="twitter:creator" content="@{{ . }}"/>{{ end }}
|
||||||
|
{{ end }}{{ end }}
|
Loading…
Reference in New Issue
Block a user