mirror of
				https://github.com/Wonderfall/hugo-WonderMod.git
				synced 2025-10-30 19:35:26 +01:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| <meta property="og:title" content="{{ .Title }}" /> | ||||
| <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" /> | ||||
| <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" /> | ||||
| <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> | ||||
| <meta property="og:url" content="{{ .Permalink }}" /> | ||||
| {{- if .Params.cover.image -}} | ||||
| @@ -19,7 +19,7 @@ | ||||
| {{- with $featured -}} | ||||
| <meta property="og:image" content="{{ $featured.Permalink }}"/> | ||||
| {{- else -}} | ||||
| {{- with $.Site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}} | ||||
| {{- with site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}} | ||||
| {{- end -}} | ||||
| {{- end -}} | ||||
| {{- end }} | ||||
| @@ -33,14 +33,14 @@ | ||||
|  | ||||
| {{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }} | ||||
| {{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }} | ||||
| {{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }} | ||||
| {{- with site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }} | ||||
| {{- with .Params.videos }}{{- range . }} | ||||
| <meta property="og:video" content="{{ . | absURL }}" /> | ||||
| {{ end }}{{ end }} | ||||
|  | ||||
| {{- /* If it is part of a series, link to related articles */}} | ||||
| {{- $permalink := .Permalink }} | ||||
| {{- $siteSeries := .Site.Taxonomies.series }} | ||||
| {{- $siteSeries := site.Taxonomies.series }} | ||||
| {{ with .Params.series }}{{- range $name := . }} | ||||
|   {{- $series := index $siteSeries ($name | urlize) }} | ||||
|   {{- range $page := first 6 $series.Pages }} | ||||
| @@ -49,4 +49,4 @@ | ||||
| {{ end }}{{ end }} | ||||
|  | ||||
| {{- /* Facebook Page Admin ID for Domain Insights */}} | ||||
| {{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }} | ||||
| {{- with site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }} | ||||
|   | ||||
| @@ -2,23 +2,23 @@ | ||||
| <script type="application/ld+json"> | ||||
| { | ||||
|   "@context": "https://schema.org", | ||||
|   "@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | title -}}", | ||||
|   "name": {{ .Site.Title }}, | ||||
|   "url": {{ .Site.BaseURL }}, | ||||
|   "description": {{ .Site.Params.description | plainify | truncate 180 | safeHTML }}, | ||||
|   "thumbnailUrl": {{ .Site.Params.assets.favicon | default "favicon.ico" | absURL }}, | ||||
|   "@type": "{{- ( site.Params.schema.publisherType | default "Organization") | title -}}", | ||||
|   "name": {{ site.Title }}, | ||||
|   "url": {{ site.BaseURL }}, | ||||
|   "description": {{ site.Params.description | plainify | truncate 180 | safeHTML }}, | ||||
|   "thumbnailUrl": {{ site.Params.assets.favicon | default "favicon.ico" | absURL }}, | ||||
|   "sameAs": [ | ||||
|     {{- if .Site.Params.schema.sameAs }} | ||||
|       {{ range $i, $e := .Site.Params.schema.sameAs }}{{ if $i }}, {{ end }}{{ trim $e " " }}{{ end }} | ||||
|     {{- if site.Params.schema.sameAs }} | ||||
|       {{ range $i, $e := site.Params.schema.sameAs }}{{ if $i }}, {{ end }}{{ trim $e " " }}{{ end }} | ||||
|     {{- else}} | ||||
|       {{ range $i, $e := .Site.Params.SocialIcons }}{{ if $i }}, {{ end }}{{ trim $e.url " " }}{{ end }} | ||||
|       {{ range $i, $e := site.Params.SocialIcons }}{{ if $i }}, {{ end }}{{ trim $e.url " " }}{{ end }} | ||||
|     {{- end}} | ||||
|   ] | ||||
| } | ||||
| </script> | ||||
| {{- 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 }} | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
| <meta name="twitter:card" content="summary_large_image"/> | ||||
| <meta name="twitter:image" content="{{ $featured.Permalink }}"/> | ||||
| {{- else -}} | ||||
| {{- with $.Site.Params.images -}} | ||||
| {{- with site.Params.images -}} | ||||
| <meta name="twitter:card" content="summary_large_image"/> | ||||
| <meta name="twitter:image" content="{{ index . 0 | absURL }}"/> | ||||
| {{ else -}} | ||||
| @@ -27,7 +27,7 @@ | ||||
| {{- end }} | ||||
| {{- end }} | ||||
| <meta name="twitter:title" content="{{ .Title }}"/> | ||||
| <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/> | ||||
| {{ with .Site.Social.twitter -}} | ||||
| <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/> | ||||
| {{ with site.Social.twitter -}} | ||||
| <meta name="twitter:site" content="@{{ . }}"/> | ||||
| {{ end -}} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Aditya Telange
					Aditya Telange