hugo-theme-relearn/layouts/partials/archetype.html
2022-07-06 00:15:33 +02:00

14 lines
No EOL
561 B
HTML

{{- $archetype := "default" }}
{{- if .page.Params.archetype }}
{{- $archetype = .page.Params.archetype }}
{{- else if .page.Params.chapter }}
{{- $archetype = "deprecated-chapter" }}
{{- else if .page.IsHome }}
{{- $archetype = "deprecated-home" }}
{{- end }}
{{- if not (fileExists (printf "/layouts/partials/archetypes/%s" $archetype)) }}
{{- $archetype = "default" }}
{{- end }}
{{- if (fileExists (printf "/layouts/partials/archetypes/%s/%s.html" $archetype .hook)) }}
{{- partial (printf "archetypes/%s/%s.html" $archetype .hook) . }}
{{- end }}