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/templates/schema_json.html | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'layouts/partials/templates/schema_json.html') diff --git a/layouts/partials/templates/schema_json.html b/layouts/partials/templates/schema_json.html index 5cf3857..74abbb5 100644 --- a/layouts/partials/templates/schema_json.html +++ b/layouts/partials/templates/schema_json.html @@ -2,23 +2,23 @@ {{- else if (or .IsPage .IsSection) }} {{/* BreadcrumbList */}} -{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }} +{{- $url := replace .Parent.Permalink ( printf "%s" site.BaseURL) "" }} {{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }} {{- $bc_list := (split $lang_url "/")}} @@ -31,7 +31,7 @@ {{- range $index, $element := $bc_list }} {{- $scratch.Add "path" (printf "%s/" $element ) | safeJS }} - {{- $bc_pg := $.Site.GetPage ($scratch.Get "path") -}} + {{- $bc_pg := site.GetPage ($scratch.Get "path") -}} {{- if (and ($bc_pg) (gt (len . ) 0))}} {{- if (and $index)}}, {{end }} @@ -83,7 +83,7 @@ {{- end -}} "datePublished": {{ .PublishDate }}, "dateModified": {{ .Lastmod }}, - {{- with (.Params.author | default .Site.Params.author) }} + {{- with (.Params.author | default site.Params.author) }} "author": {{- if (or (eq (printf "%T" .) "[]string") (eq (printf "%T" .) "[]interface {}")) -}} [{{- range $i, $v := . -}} @@ -105,11 +105,11 @@ "@id": {{ .Permalink | safeHTML }} }, "publisher": { - "@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | title -}}", - "name": {{ .Site.Title }}, + "@type": "{{- ( site.Params.schema.publisherType | default "Organization") | title -}}", + "name": {{ site.Title }}, "logo": { "@type": "ImageObject", - "url": {{ .Site.Params.assets.favicon | default "favicon.ico" | absURL }} + "url": {{ site.Params.assets.favicon | default "favicon.ico" | absURL }} } } } -- cgit v1.2.3