{{- $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/releasenotes/5/#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)) }} {{- $content = .RenderShortcodes }} {{- else with or ($page.Page.Resources.Get $path) (resources.Get $path) }} {{- $content = .Content }} {{- else }} {{- if (fileExists .file) }} {{- $content = .file | readFile }} {{- else }} {{- $errorlevel := or $page.Params.include.errorlevel $page.Site.Params.include.errorlevel }} {{- if eq $errorlevel "warning" }} {{- warnf "%q: included file '%s' is not a page, resource or accessible via file system" $page.File.Filename .file }} {{- else if eq $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 }} {{- end }}