From 575cc0ca8c4e5904c7ae77e76db812c52e5f8ed1 Mon Sep 17 00:00:00 2001
From: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
Date: Sun, 27 Mar 2022 18:44:06 +0530
Subject: Use `site` function instead of `.Site` or `$.Site`
- The site function provides global access to the same data as the .Site page method.
- Current context (`.`) is never considered.
---
layouts/partials/author.html | 4 +-
layouts/partials/breadcrumbs.html | 4 +-
layouts/partials/cover.html | 6 +--
layouts/partials/edit_post.html | 8 ++--
layouts/partials/footer.html | 12 +++---
layouts/partials/head.html | 56 +++++++++++++--------------
layouts/partials/header.html | 30 +++++++-------
layouts/partials/home_info.html | 4 +-
layouts/partials/index_profile.html | 6 +--
layouts/partials/post_canonical.html | 4 +-
layouts/partials/post_meta.html | 2 +-
layouts/partials/templates/opengraph.html | 10 ++---
layouts/partials/templates/schema_json.html | 28 +++++++-------
layouts/partials/templates/twitter_cards.html | 6 +--
layouts/partials/translation_list.html | 4 +-
15 files changed, 92 insertions(+), 92 deletions(-)
(limited to 'layouts/partials')
diff --git a/layouts/partials/author.html b/layouts/partials/author.html
index 4582b12..8f2758f 100644
--- a/layouts/partials/author.html
+++ b/layouts/partials/author.html
@@ -1,5 +1,5 @@
-{{- if or .Params.author .Site.Params.author }}
-{{- $author := (.Params.author | default .Site.Params.author) }}
+{{- if or .Params.author site.Params.author }}
+{{- $author := (.Params.author | default site.Params.author) }}
{{- $author_type := (printf "%T" $author) }}
{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
{{- (delimit $author ", " ) }}
diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html
index 742254a..7e8257b 100644
--- a/layouts/partials/breadcrumbs.html
+++ b/layouts/partials/breadcrumbs.html
@@ -1,6 +1,6 @@
{{- if (.Param "ShowBreadCrumbs") -}}
- {{- $url := replace .Parent.Permalink (printf "%s" .Site.BaseURL) "" }}
+ {{- $url := replace .Parent.Permalink (printf "%s" site.BaseURL) "" }}
{{- $lang_url := strings.TrimPrefix (printf "%s/" .Lang) $url -}}
{{ i18n "home" | default "Home" }}
@@ -8,7 +8,7 @@
{{- range $index, $element := split $lang_url "/" }}
{{- $scratch.Add "path" (printf "%s/" $element )}}
- {{- $bc_pg := $.Site.GetPage ($scratch.Get "path") -}}
+ {{- $bc_pg := site.GetPage ($scratch.Get "path") -}}
{{- if (and ($bc_pg) (gt (len . ) 0))}}
{{- print " ยป " | safeHTML -}}
{{ $bc_pg.Name }}
diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html
index b4e7c78..5c5f2fb 100644
--- a/layouts/partials/cover.html
+++ b/layouts/partials/cover.html
@@ -2,8 +2,8 @@
{{- if (and .Params.cover.image (not $.isHidden)) }}
{{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }}
- {{- $responsiveImages := (.Params.cover.responsiveImages | default .Site.Params.cover.responsiveImages) | default true }}
- {{- $addLink := (and .Site.Params.cover.linkFullImages (not $.IsHome)) }}
+ {{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }}
+ {{- $addLink := (and site.Params.cover.linkFullImages (not $.IsHome)) }}
{{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
{{- if $cover -}}{{/* i.e it is present in page bundle */}}
{{- if $addLink }}
- {{- .Params.editPost.Text | default (.Site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}}
+{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }} | {{- end -}}
+
+ {{- .Params.editPost.Text | default (site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}}
{{- end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 8dee328..d76058f 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,9 +1,9 @@
{{- if not (.Param "hideFooter") }}
{{- end }}
-{{- if (not .Site.Params.disableScrollToTop) }}
+{{- if (not site.Params.disableScrollToTop) }}