mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-23 18:31:45 +01:00
Merge pull request #10 from CaiJimmy/partials-cache
feat: add partialCached for some of the most invocated partial templates
This commit is contained in:
commit
4a12e6fc31
11 changed files with 16 additions and 16 deletions
|
@ -8,5 +8,5 @@
|
||||||
|
|
||||||
{{ partialCached "footer/footer" . }}
|
{{ partialCached "footer/footer" . }}
|
||||||
|
|
||||||
{{ partial "article/components/photoswipe" . }}
|
{{ partialCached "article/components/photoswipe" . }}
|
||||||
{{ end }}
|
{{ end }}
|
|
@ -9,7 +9,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ $image := partial "helper/image" (dict "Context" . "Type" "taxonomy") }}
|
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "taxonomy") .RelPermalink }}
|
||||||
{{ if $image.exists }}
|
{{ if $image.exists }}
|
||||||
<div class="taxonomy-image">
|
<div class="taxonomy-image">
|
||||||
{{ if $image.resource }}
|
{{ if $image.resource }}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ $image := partial "helper/image" (dict "Context" . "Type" "articleList") }}
|
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink }}
|
||||||
|
|
||||||
{{ if $image.exists }}
|
{{ if $image.exists }}
|
||||||
<div class="article-image">
|
<div class="article-image">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{ $image := partial "helper/image" (dict "Context" . "Type" "articleList") }}
|
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink }}
|
||||||
<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 := partial "helper/image" (dict "Context" .context "Type" .Type) }}
|
{{ $image := partialCached "helper/image" (dict "Context" .context "Type" .Type) .context.RelPermalink }}
|
||||||
<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 := partial "helper/image" (dict "Context" .) }}
|
{{ $image := partialCached "helper/image" (dict "Context" .) .RelPermalink }}
|
||||||
{{ $context := . }}
|
{{ $context := . }}
|
||||||
<div class="article-details">
|
<div class="article-details">
|
||||||
{{ with $categories := .Params.categories }}
|
{{ with $categories := .Params.categories }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<header class="article-header">
|
<header class="article-header">
|
||||||
{{ $image := partial "helper/image" (dict "Context" . "Type" "article") }}
|
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink }}
|
||||||
|
|
||||||
{{ if $image.exists }}
|
{{ if $image.exists }}
|
||||||
<div class="article-image">
|
<div class="article-image">
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<meta charset='utf-8'>
|
<meta charset='utf-8'>
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||||
|
|
||||||
{{- $description := partial "data/description" . -}}
|
{{- $description := partialCached "data/description" . .RelPermalink -}}
|
||||||
<meta name='description' content='{{ $description }}'>
|
<meta name='description' content='{{ $description }}'>
|
||||||
|
|
||||||
{{- $title := partial "data/title" . -}}
|
{{- $title := partialCached "data/title" . .RelPermalink -}}
|
||||||
<title>{{ $title }}</title>
|
<title>{{ $title }}</title>
|
||||||
|
|
||||||
<link rel='canonical' href='{{ .Permalink }}'>
|
<link rel='canonical' href='{{ .Permalink }}'>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{- $title := partial "data/title" . -}}
|
{{- $title := partialCached "data/title" . .RelPermalink -}}
|
||||||
{{- $description := partial "data/description" . -}}
|
{{- $description := partialCached "data/description" . .RelPermalink -}}
|
||||||
|
|
||||||
<meta property='og:title' content='{{ $title }}'>
|
<meta property='og:title' content='{{ $title }}'>
|
||||||
<meta property='og:description' content='{{ $description }}'>
|
<meta property='og:description' content='{{ $description }}'>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{ $image := partial "helper/image" (dict "Context" . "Type" "opengraph") }}
|
{{ $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink }}
|
||||||
{{- if $image.exists -}}
|
{{- if $image.exists -}}
|
||||||
<meta property='og:image' content='{{ absURL $image.permalink }}' />
|
<meta property='og:image' content='{{ absURL $image.permalink }}' />
|
||||||
{{- end -}}
|
{{- end -}}
|
|
@ -2,13 +2,13 @@
|
||||||
<meta name="twitter:site" content="{{ . }}">
|
<meta name="twitter:site" content="{{ . }}">
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- $title := partial "data/title" . -}}
|
{{- $title := partialCached "data/title" . .RelPermalink -}}
|
||||||
{{- $description := partial "data/description" . -}}
|
{{- $description := partialCached "data/description" . .RelPermalink -}}
|
||||||
|
|
||||||
<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 := partial "helper/image" (dict "Context" . "Type" "opengraph") -}}
|
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink -}}
|
||||||
{{- 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 }}' />
|
||||||
|
|
|
@ -17,5 +17,5 @@
|
||||||
|
|
||||||
{{ partialCached "footer/footer" . }}
|
{{ partialCached "footer/footer" . }}
|
||||||
|
|
||||||
{{- partial "article/components/photoswipe.html" . -}}
|
{{- partialCached "article/components/photoswipe.html" . -}}
|
||||||
{{ end }}
|
{{ end }}
|
Loading…
Reference in a new issue