huge upgrade to theme and pagefind search bar.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{{- return (partial "docs/text/template" (dict "Template" .Site.Params.BookLastChangeLink "Context" (dict
|
||||
"Site" .Site
|
||||
"Page" .Page
|
||||
"GitInfo" .GitInfo
|
||||
)) | urls.JoinPath) -}}
|
||||
@@ -0,0 +1,5 @@
|
||||
{{- return (partial "docs/text/template" (dict "Template" .Site.Params.BookEditLink "Context" (dict
|
||||
"Site" .Site
|
||||
"Page" .Page
|
||||
"Path" (strings.TrimPrefix hugo.WorkingDir .Page.File.Filename)
|
||||
)) | urls.JoinPath) -}}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{- $destination := .Destination -}}
|
||||
{{- $url := urls.Parse .Destination -}}
|
||||
|
||||
{{- $isRemote := $url.IsAbs -}}
|
||||
{{- $isFragment := strings.HasPrefix .Destination "#" -}}
|
||||
|
||||
{{- if and (not $isRemote) (not $isFragment) -}}
|
||||
{{- $path := strings.TrimPrefix "./" $url.Path -}}
|
||||
{{- $path = strings.TrimPrefix "/assets/" $path -}}
|
||||
|
||||
{{- with (.Page.Resources.Get $path) -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- else with (resources.Get $path) -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- else -}}
|
||||
{{- $mode := .Page.Site.Params.BookPortableLinks -}}
|
||||
{{- $message := printf "Image reference '%s' not found in '%s'" .Destination .Page.RelPermalink -}}
|
||||
{{- if eq $mode "warning" -}}
|
||||
{{- warnf $message -}}
|
||||
{{- else if eq $mode "error" -}}
|
||||
{{- errorf $message -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $url.RawQuery -}}
|
||||
{{- $destination = print $destination "?" . -}}
|
||||
{{- end -}}
|
||||
{{- with $url.Fragment -}}
|
||||
{{- $destination = print $destination "#" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $destination -}}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- $destination := .Destination -}}
|
||||
{{- $url := urls.Parse .Destination -}}
|
||||
|
||||
{{- $isRemote := $url.IsAbs -}}
|
||||
{{- $isFragment := strings.HasPrefix .Destination "#" -}}
|
||||
|
||||
{{- if and (not $isRemote) (not $isFragment) -}}
|
||||
{{- $path := strings.TrimPrefix "./" $url.Path -}}
|
||||
{{- $path = strings.TrimSuffix ".md" $path -}}
|
||||
{{- $path = strings.TrimSuffix "/_index" $path -}}
|
||||
|
||||
{{- with (.Page.GetPage $path) -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- else with (.Page.Resources.Get $path) -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- else with (resources.Get $path) -}}
|
||||
{{- $destination = .RelPermalink -}}
|
||||
{{- else -}}
|
||||
{{- $mode := .Page.Site.Params.BookPortableLinks -}}
|
||||
{{- $message := printf "Image reference '%s' not found in '%s'" .Destination .Page.RelPermalink -}}
|
||||
{{- if eq $mode "warning" -}}
|
||||
{{- warnf $message -}}
|
||||
{{- else if eq $mode "error" -}}
|
||||
{{- errorf $message -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $url.RawQuery -}}
|
||||
{{- $destination = print $destination "?" . -}}
|
||||
{{- end -}}
|
||||
{{- with $url.Fragment -}}
|
||||
{{- $destination = print $destination "#" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $destination -}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- site.Store.SetInMap "book-sw-precache" .RelPermalink true -}}
|
||||
{{- return .RelPermalink -}}
|
||||
Reference in New Issue
Block a user