fix: add .Type as second cache key for helper/image
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/12
This commit is contained in:
parent
c74cc3e4b3
commit
93146c9dc3
@ -7,7 +7,7 @@
|
|||||||
<div class="category-list">
|
<div class="category-list">
|
||||||
<div class="article-list--tile">
|
<div class="article-list--tile">
|
||||||
{{ range $categories }}
|
{{ range $categories }}
|
||||||
{{ partial "article-list/tile" (dict "context" . "size" "250x150") }}
|
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "taxonomy") }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "taxonomy") .RelPermalink }}
|
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "taxonomy") .RelPermalink "taxonomy" -}}
|
||||||
{{ if $image.exists }}
|
{{ if $image.exists }}
|
||||||
<div class="taxonomy-image">
|
<div class="taxonomy-image">
|
||||||
{{ if $image.resource }}
|
{{ if $image.resource }}
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink }}
|
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
|
||||||
|
|
||||||
{{ if $image.exists }}
|
{{ if $image.exists }}
|
||||||
<div class="article-image">
|
<div class="article-image">
|
||||||
{{ if $image.resource }}
|
{{ if $image.resource }}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink }}
|
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" }}
|
||||||
<article class="{{ if $image.exists }}has-image{{ end }}">
|
<article class="{{ if $image.exists }}has-image{{ end }}">
|
||||||
{{ if $image.exists }}
|
{{ if $image.exists }}
|
||||||
<div class="article-image">
|
<div class="article-image">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{ $image := partialCached "helper/image" (dict "Context" .context "Type" .Type) .context.RelPermalink }}
|
{{ $image := partialCached "helper/image" (dict "Context" .context "Type" .Type) .context.RelPermalink .Type }}
|
||||||
<article class="{{ if $image.exists }}has-image{{ end }}">
|
<article class="{{ if $image.exists }}has-image{{ end }}">
|
||||||
<a href="{{ .context.Permalink }}">
|
<a href="{{ .context.Permalink }}">
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{ $image := partialCached "helper/image" (dict "Context" .) .RelPermalink }}
|
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink "article" }}
|
||||||
{{ $context := . }}
|
{{ $context := . }}
|
||||||
<div class="article-details">
|
<div class="article-details">
|
||||||
{{ with $categories := .Params.categories }}
|
{{ with $categories := .Params.categories }}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<header class="article-header">
|
<header class="article-header">
|
||||||
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink }}
|
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink "article" -}}
|
||||||
|
|
||||||
{{ if $image.exists }}
|
{{ if $image.exists }}
|
||||||
<div class="article-image">
|
<div class="article-image">
|
||||||
{{ if $image.resource }}
|
{{ if $image.resource }}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<div class="related-contents">
|
<div class="related-contents">
|
||||||
<div class="flex article-list--tile">
|
<div class="flex article-list--tile">
|
||||||
{{ range . }}
|
{{ range . }}
|
||||||
{{ partial "article-list/tile" (dict "context" . "size" "250x150") }}
|
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "articleList") }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink }}
|
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" }}
|
||||||
{{- if $image.exists -}}
|
{{- if $image.exists -}}
|
||||||
<meta property='og:image' content='{{ absURL $image.permalink }}' />
|
<meta property='og:image' content='{{ absURL $image.permalink }}' />
|
||||||
{{- end -}}
|
{{- end -}}
|
@ -8,7 +8,7 @@
|
|||||||
<meta name="twitter:title" content="{{ $title }}">
|
<meta name="twitter:title" content="{{ $title }}">
|
||||||
<meta name="twitter:description" content="{{ $description }}">
|
<meta name="twitter:description" content="{{ $description }}">
|
||||||
|
|
||||||
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink -}}
|
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" -}}
|
||||||
{{- if $image.exists -}}
|
{{- if $image.exists -}}
|
||||||
<meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}">
|
<meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}">
|
||||||
<meta name="twitter:image" content='{{ absURL $image.permalink }}' />
|
<meta name="twitter:image" content='{{ absURL $image.permalink }}' />
|
||||||
|
Loading…
Reference in New Issue
Block a user