Rename context variable: "dot" -> "page"

Unified a variable name to pass context across layouts partials
This commit is contained in:
vimux 2019-10-01 13:04:01 -04:00
parent 5a51cb05c4
commit 77b9fc1ec7
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34
3 changed files with 5 additions and 5 deletions

View file

@ -3,7 +3,7 @@
<div class="single block">
<article class="post">
{{- partial "post_featured.html" (dict "page" . "IsSingle" true) }}
{{- partial "post_meta.html" (dict "dot" . "class" "mb") }}
{{- partial "post_meta.html" (dict "page" . "class" "mb") }}
<h1 class="post__title">{{ .Title }}</h1>
{{- partial "post_toc.html" . }}
<div class="post__content">{{ .Content }}</div>

View file

@ -4,5 +4,5 @@
{{- with .Summary }}
<div class="post__content">{{ . }}</div>
{{- end }}
{{- partial "post_meta.html" (dict "dot" . "class" "mt tar") }}
{{- partial "post_meta.html" (dict "page" . "class" "mt tar") }}
</article>

View file

@ -1,7 +1,7 @@
{{ $currentPage := .dot }}
{{- if .dot.Param "post_meta" }}
{{ $currentPage := .page }}
{{- if .page.Param "post_meta" }}
<div class="post__meta meta {{ .class }}">
{{- range $metaField := .dot.Param "post_meta" -}}
{{- range $metaField := .page.Param "post_meta" -}}
{{- $metaFieldPath := printf "post_meta/%s.html" $metaField -}}
{{- partial $metaFieldPath $currentPage -}}
{{ end }}