{{- /* Here's where all of the inline partials are defined. If the partial is short enough, it should be put here. */ -}} {{- /* This is a partial that creates an icon from the icon templates. */ -}} {{- define "partials/components/icon.html" }} {{- $icon := . }} {{- $res := resources.ExecuteAsTemplate (printf $icon.output $icon.id) $icon.id (resources.Get $icon.template) }} {{- end }} {{- /* A partial that aliases the Heroicon template from the icon partial */ -}} {{- define "partials/components/heroicon.html" }} {{- partial "components/icon.html" (dict "id" . "output" "icons/generic/%s.svg" "template" "templates/heroicon.svg") }} {{ end }} {{- define "partials/components/theme-button.html" }} {{- if gt (len (index $.Site.Data "more-contentful").themes) 1 }}
{{ partial "components/heroicon.html" "color-swatch" }}
{{- range $filename, $scheme := (index $.Site.Data "more-contentful").themes }} {{- $name := cond (eq $filename "_index") (printf "%s (default)" .scheme) .scheme }}
{{ $name }}
{{- end }}
{{- end }} {{- end }} {{- define "partials/components/post-meta.html" }}
{{- if ne (.PublishDate.Format "2006") "0001" -}} {{- end }} {{- if and .GitInfo (ne (.Date.Format "2006-01-02") (.Lastmod.Format "2006-01-02")) }} {{- end }} {{- /* The authors are appended with 'et al' if there's more than one author in the map. */ -}} {{ with .Params.author }} {{ $author := index (first 1 .) 0 }} {{ partial "components/heroicon.html" "pencil" }} {{ $author.name }}{{ if ge (len .) 2 }}, et al.{{ end }} {{ end }}
{{- end }}