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:
Diffstat (limited to 'layouts/partials/head/opengraph.html')
-rw-r--r--layouts/partials/head/opengraph.html12
1 files changed, 8 insertions, 4 deletions
diff --git a/layouts/partials/head/opengraph.html b/layouts/partials/head/opengraph.html
index dd298c2..654c55c 100644
--- a/layouts/partials/head/opengraph.html
+++ b/layouts/partials/head/opengraph.html
@@ -40,11 +40,15 @@
{{- end -}}
{{- end -}}
-{{- if .Params.image -}}
- {{ $image := partial "helper/image" . }}
+{{ $image := partial "helper/image" . }}
+{{- if $image.exists -}}
+ {{ $imagePermalink := $image.src }}
+ {{ if $image.local }}
+ {{ $imagePermalink = absURL $image.src.RelPermalink }}
+ {{ end }}
<meta name="twitter:card" content="summary_large_image">
- <meta property='og:image' content='{{ absURL $image.RelPermalink }}' />
- <meta name="twitter:image" content='{{ absURL $image.RelPermalink }}' />
+ <meta property='og:image' content='{{ $imagePermalink }}' />
+ <meta name="twitter:image" content='{{ $imagePermalink }}' />
{{- else if .Site.Params.opengraph.defaultImage -}}
{{ $image := resources.Get .Site.Params.opengraph.defaultImage }}
<meta property='og:image' content='{{ absURL $image.RelPermalink }}' />