{{- $page := .page }} {{- if and (not $page) .context }} {{- $page = .context }} {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'include' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }} {{- end }} {{- $u := urls.Parse .file }} {{- $path := strings.TrimPrefix "./" $u.Path }} {{- $content := "" }} {{- with or ($page.Page.GetPage $path) ($page.Page.GetPage (strings.TrimRight "/" $path)) ($page.Page.Resources.Get $path) (resources.Get $path) }} {{- $content = .Content }} {{- else }} {{- if (fileExists .file) }} {{- $content = .file | readFile }} {{- else }} {{- if eq $page.Site.Params.include.errorlevel "warning" }} {{- warnf "%q: included file '%s' is not a page, resource or accessible via file system" $page.File.Filename .file }} {{- else if eq $page.Site.Params.include.errorlevel "error" }} {{- errorf "%q: included file '%s' is not a page, resource or accessible via file system" $page.File.Filename .file }} {{- end }} {{- end }} {{- end }} {{- $hideFirstHeading := .hidefirstheading | default false }} {{- if eq (printf "%T" $hideFirstHeading) "string" }} {{- $hideFirstHeading = (eq $hideFirstHeading "true") }} {{- end }} {{- if $content }} {{- if $hideFirstHeading }}
{{ end }} {{- with $page }} {{- $content | safeHTML }} {{- end }} {{- if $hideFirstHeading }}
{{ end }} {{- end }}