2023-07-27 16:14:55 +02:00
|
|
|
{{- $page := .page }}
|
|
|
|
{{- if and (not $page) .context }}
|
|
|
|
{{- $page = .context }}
|
2025-02-07 20:09:04 +01:00
|
|
|
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
|
|
|
{{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'include' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/5/#5-18-0" $filepath }}
|
2023-07-27 16:14:55 +02:00
|
|
|
{{- end }}
|
2024-04-19 17:58:38 +02:00
|
|
|
{{- $content := "" }}
|
2025-02-07 20:09:04 +01:00
|
|
|
{{- $linkObject := or
|
|
|
|
(partial "_relearn/linkObject.gotmpl" (dict "url" .file "page" $page "searchGlobal" false "searchResource" false))
|
|
|
|
(partial "_relearn/linkObject.gotmpl" (dict "url" .file "page" $page "searchPage" false)) }}
|
|
|
|
{{- if $linkObject }}
|
|
|
|
{{- $content = $linkObject.Content }}
|
2024-04-19 17:58:38 +02:00
|
|
|
{{- else }}
|
2024-05-28 22:06:17 +02:00
|
|
|
{{- if (fileExists .file) }}
|
|
|
|
{{- $content = .file | readFile }}
|
2024-04-19 17:58:38 +02:00
|
|
|
{{- else }}
|
2025-02-07 20:09:04 +01:00
|
|
|
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
|
|
|
{{- $msg := printf "%q: include '%s' is not a page, a resource or a file" $filepath .file }}
|
2025-01-29 22:17:39 +01:00
|
|
|
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .file "page" $page "param" "include" "msg" $msg) }}
|
2024-04-19 17:58:38 +02:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2022-06-23 13:22:04 +02:00
|
|
|
{{- $hideFirstHeading := .hidefirstheading | default false }}
|
|
|
|
{{- if eq (printf "%T" $hideFirstHeading) "string" }}
|
|
|
|
{{- $hideFirstHeading = (eq $hideFirstHeading "true") }}
|
2022-06-22 20:32:18 +02:00
|
|
|
{{- end }}
|
2024-04-19 17:58:38 +02:00
|
|
|
{{- if $content }}
|
2023-11-16 22:50:35 +01:00
|
|
|
{{- if $hideFirstHeading }}<div class="include hide-first-heading">
|
2022-06-22 20:32:18 +02:00
|
|
|
|
2023-11-16 22:50:35 +01:00
|
|
|
{{ end }}
|
|
|
|
{{- with $page }}
|
2024-04-19 17:58:38 +02:00
|
|
|
{{- $content | safeHTML }}
|
2023-02-19 23:09:51 +01:00
|
|
|
{{- end }}
|
|
|
|
{{- if $hideFirstHeading }}</div>{{ end }}
|
2022-06-22 20:32:18 +02:00
|
|
|
{{- end }}
|