{{- $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 }}