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:
		| @@ -11,7 +11,7 @@ | ||||
|  | ||||
| {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} | ||||
|  | ||||
| {{- if .Site.Params.ShowAllPagesInArchive }} | ||||
| {{- if site.Params.ShowAllPagesInArchive }} | ||||
| {{- $pages = site.RegularPages }} | ||||
| {{- end }} | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| <!DOCTYPE html> | ||||
| <html lang="{{ .Site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}"> | ||||
| <html lang="{{ site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}"> | ||||
|  | ||||
| <head> | ||||
|     {{- partial "head.html" . }} | ||||
| @@ -9,7 +9,7 @@ | ||||
| {{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}} | ||||
| {{- print "list" -}} | ||||
| {{- end -}} | ||||
| {{- if eq $.Site.Params.defaultTheme `dark` -}} | ||||
| {{- if eq site.Params.defaultTheme `dark` -}} | ||||
| {{- print " dark" }} | ||||
| {{- end -}} | ||||
| " id="top"> | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| {{- $.Scratch.Add "index" slice -}} | ||||
| {{- range .Site.RegularPages -}} | ||||
| {{- range site.RegularPages -}} | ||||
|     {{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) }} | ||||
|     {{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}} | ||||
|     {{- end }} | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| {{- define "main" }} | ||||
|  | ||||
| {{- if (and .Site.Params.profileMode.enabled .IsHome) }} | ||||
| {{- if (and site.Params.profileMode.enabled .IsHome) }} | ||||
| {{- partial "index_profile.html" . }} | ||||
| {{- else }} {{/* if not profileMode */}} | ||||
|  | ||||
| @@ -32,7 +32,7 @@ | ||||
|  | ||||
| {{- $paginator := .Paginate $pages }} | ||||
|  | ||||
| {{- if and .IsHome .Site.Params.homeInfoParams (eq $paginator.PageNumber 1) }} | ||||
| {{- if and .IsHome site.Params.homeInfoParams (eq $paginator.PageNumber 1) }} | ||||
| {{- partial "home_info.html" . }} | ||||
| {{- end }} | ||||
|  | ||||
| @@ -41,7 +41,7 @@ | ||||
|  | ||||
| {{- $class := "post-entry" }} | ||||
|  | ||||
| {{- $user_preferred := or .Site.Params.disableSpecial1stPost .Site.Params.homeInfoParams }} | ||||
| {{- $user_preferred := or site.Params.disableSpecial1stPost site.Params.homeInfoParams }} | ||||
| {{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) (not $user_preferred)) }} | ||||
| {{- $class = "first-entry" }} | ||||
| {{- else if $term }} | ||||
| @@ -49,7 +49,7 @@ | ||||
| {{- end }} | ||||
|  | ||||
| <article class="{{ $class }}"> | ||||
|   {{- $isHidden := (.Site.Params.cover.hidden | default .Site.Params.cover.hiddenInList) }} | ||||
|   {{- $isHidden := (site.Params.cover.hidden | default site.Params.cover.hiddenInList) }} | ||||
|   {{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }} | ||||
|   <header class="entry-header"> | ||||
|     <h2> | ||||
|   | ||||
| @@ -1,31 +1,31 @@ | ||||
| {{- $pctx := . -}} | ||||
| {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} | ||||
| {{- if .IsHome -}}{{ $pctx = site }}{{- end -}} | ||||
| {{- $pages := slice -}} | ||||
| {{- if or $.IsHome $.IsSection -}} | ||||
| {{- $pages = $pctx.RegularPages -}} | ||||
| {{- else -}} | ||||
| {{- $pages = $pctx.Pages -}} | ||||
| {{- end -}} | ||||
| {{- $limit := .Site.Config.Services.RSS.Limit -}} | ||||
| {{- $limit := site.Config.Services.RSS.Limit -}} | ||||
| {{- if ge $limit 1 -}} | ||||
| {{- $pages = $pages | first $limit -}} | ||||
| {{- end -}} | ||||
| {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} | ||||
| <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"> | ||||
|   <channel> | ||||
|     <title>{{ if eq  .Title  .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> | ||||
|     <title>{{ if eq  .Title  site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ site.Title }}{{ end }}</title> | ||||
|     <link>{{ .Permalink }}</link> | ||||
|     <description>Recent content {{ if ne  .Title  .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> | ||||
|     {{- with $.Site.Params.images }} | ||||
|     <description>Recent content {{ if ne  .Title  site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ site.Title }}</description> | ||||
|     {{- with site.Params.images }} | ||||
|     <image> | ||||
|       <url>{{ index . 0 | absURL }}</url> | ||||
|       <link>{{ index . 0 | absURL }}</link> | ||||
|     </image> | ||||
|     {{- end }} | ||||
|     <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} | ||||
|     <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} | ||||
|     <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} | ||||
|     <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} | ||||
|     <generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }} | ||||
|     <language>{{.}}</language>{{end}}{{ with site.Author.email }} | ||||
|     <managingEditor>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with site.Author.email }} | ||||
|     <webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with site.Copyright }} | ||||
|     <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} | ||||
|     <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} | ||||
|     {{- with .OutputFormats.Get "RSS" -}} | ||||
| @@ -37,10 +37,10 @@ | ||||
|       <title>{{ .Title }}</title> | ||||
|       <link>{{ .Permalink }}</link> | ||||
|       <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> | ||||
|       {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} | ||||
|       {{ with site.Author.email }}<author>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</author>{{end}} | ||||
|       <guid>{{ .Permalink }}</guid> | ||||
|       <description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description> | ||||
|       {{- if .Site.Params.ShowFullTextinRSS }} | ||||
|       {{- if site.Params.ShowFullTextinRSS }} | ||||
|       <content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded> | ||||
|       {{- end }} | ||||
|     </item> | ||||
|   | ||||
| @@ -21,7 +21,7 @@ | ||||
|     </div> | ||||
|     {{- end }} | ||||
|   </header> | ||||
|   {{- $isHidden := .Params.cover.hidden | default .Site.Params.cover.hiddenInSingle | default .Site.Params.cover.hidden }} | ||||
|   {{- $isHidden := .Params.cover.hidden | default site.Params.cover.hiddenInSingle | default site.Params.cover.hidden }} | ||||
|   {{- partial "cover.html" (dict "cxt" . "IsHome" false "isHidden" $isHidden) }} | ||||
|   {{- if (.Param "ShowToc") }} | ||||
|   {{- partial "toc.html" . }} | ||||
| @@ -46,7 +46,7 @@ | ||||
|     {{- if (.Param "ShowPostNavLinks") }} | ||||
|     {{- partial "post_nav_links.html" . }} | ||||
|     {{- end }} | ||||
|     {{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true)) }} | ||||
|     {{- if (and site.Params.ShowShareButtons (ne .Params.disableShare true)) }} | ||||
|     {{- partial "share_icons.html" . -}} | ||||
|     {{- end }} | ||||
|   </footer> | ||||
|   | ||||
| @@ -16,7 +16,7 @@ | ||||
|     {{- range $key, $value := .Data.Terms.Alphabetical }} | ||||
|     {{- $name := .Name }} | ||||
|     {{- $count := .Count }} | ||||
|     {{- with $.Site.GetPage (printf "/%s/%s" $type $name) }} | ||||
|     {{- with site.GetPage (printf "/%s/%s" $type $name) }} | ||||
|     <li> | ||||
|         <a href="{{ .Permalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a> | ||||
|     </li> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Aditya Telange
					Aditya Telange