Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Cai <jimmehcai@gmail.com>2020-12-20 13:05:34 +0300
committerGitHub <noreply@github.com>2020-12-20 13:05:34 +0300
commit25a72940b8184b41de36fec9a3fcdd6387e006b0 (patch)
tree3064f6b35d4a7b5e1c6354b9dbb74a4d7883dc22 /layouts
parentd2057533233c480fde3c526d865cfb1276d6b4ef (diff)
refactor(opengraph): add default value for twitter:card (#72)
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/head/opengraph/provider/base.html38
-rw-r--r--layouts/partials/head/opengraph/provider/twitter.html4
2 files changed, 21 insertions, 21 deletions
diff --git a/layouts/partials/head/opengraph/provider/base.html b/layouts/partials/head/opengraph/provider/base.html
index 8e90a45..3e51d37 100644
--- a/layouts/partials/head/opengraph/provider/base.html
+++ b/layouts/partials/head/opengraph/provider/base.html
@@ -6,35 +6,35 @@
<meta property='og:url' content='{{ .Permalink }}'>
<meta property='og:site_name' content='{{ .Site.Title }}'>
<meta property='og:type' content='
- {{- if .IsPage -}}
- article
- {{- else -}}
- website
- {{- end -}}
+ {{- if .IsPage -}}
+ article
+ {{- else -}}
+ website
+ {{- end -}}
'>
{{- with .Params.locale -}}
- <meta property='og:locale' content='{{ . }}'>
+ <meta property='og:locale' content='{{ . }}'>
{{- end -}}
{{- if .IsPage -}}
- <meta property='article:section' content='{{ .Section | title }}' />
- {{- range .Params.tags -}}
- <meta property='article:tag' content='{{ . }}' />
- {{- end -}}
+ <meta property='article:section' content='{{ .Section | title }}' />
+ {{- range .Params.tags -}}
+ <meta property='article:tag' content='{{ . }}' />
+ {{- end -}}
{{- end -}}
{{- if .IsPage -}}
- {{- if not .Date.IsZero -}}
- <meta property='article:published_time' content='{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
- {{- end -}}
- {{- if not .Lastmod.IsZero -}}
- <meta property='article:modified_time' content='{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
- {{- end -}}
+ {{- if not .Date.IsZero -}}
+ <meta property='article:published_time' content='{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
+ {{- end -}}
+ {{- if not .Lastmod.IsZero -}}
+ <meta property='article:modified_time' content='{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
+ {{- end -}}
{{- else -}}
- {{- if not .Site.LastChange.IsZero -}}
- <meta property='og:updated_time' content='{{ .Site.LastChange.Format " 2006-01-02T15:04:05-07:00 " | safeHTML }}'/>
- {{- end -}}
+ {{- if not .Site.LastChange.IsZero -}}
+ <meta property='og:updated_time' content='{{ .Site.LastChange.Format " 2006-01-02T15:04:05-07:00 " | safeHTML }}'/>
+ {{- end -}}
{{- end -}}
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" }}
diff --git a/layouts/partials/head/opengraph/provider/twitter.html b/layouts/partials/head/opengraph/provider/twitter.html
index ecb6680..e74441d 100644
--- a/layouts/partials/head/opengraph/provider/twitter.html
+++ b/layouts/partials/head/opengraph/provider/twitter.html
@@ -10,6 +10,6 @@
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" -}}
{{- if $image.exists -}}
- <meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}">
- <meta name="twitter:image" content='{{ absURL $image.permalink }}' />
+ <meta name="twitter:card" content="{{ default `summary_large_image` .Site.Params.opengraph.twitter.card }}">
+ <meta name="twitter:image" content='{{ absURL $image.permalink }}' />
{{- end -}} \ No newline at end of file