feat: add partialCached to helper/image invocation

Using .RelPermalink as key for cache
This commit is contained in:
Jimmy Cai
2020-09-17 21:52:06 +02:00
parent 9a64b7a6f1
commit cf6502c311
8 changed files with 8 additions and 8 deletions
@@ -37,7 +37,7 @@
{{- end -}}
{{- end -}}
{{ $image := partial "helper/image" (dict "Context" . "Type" "opengraph") }}
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink }}
{{- if $image.exists -}}
<meta property='og:image' content='{{ absURL $image.permalink }}' />
{{- end -}}
@@ -8,7 +8,7 @@
<meta name="twitter:title" content="{{ $title }}">
<meta name="twitter:description" content="{{ $description }}">
{{- $image := partial "helper/image" (dict "Context" . "Type" "opengraph") -}}
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink -}}
{{- if $image.exists -}}
<meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}">
<meta name="twitter:image" content='{{ absURL $image.permalink }}' />