Files
website/layouts/partials/react.html
T
2025-03-26 23:12:54 -07:00

17 lines
751 B
HTML

{{- /* Check if any React components are requested in the front matter */ -}}
{{- $reactParams := .Params.react -}}
{{- if $reactParams -}}
{{- /* Include the React core partial once */ -}}
{{- partialCached "react/core.html" . "react-core" -}}
{{- /* reactParams is is true (and not a list), skip adding components */ -}}
{{- if not (eq $reactParams true) -}}
{{- /* Loop over each requested component and include its corresponding partial */ -}}
{{- range $component := $reactParams -}}
{{- $reactComponent := printf "react/%s" $component -}}
{{- $componentPartial := printf "%s.html" $reactComponent -}}
{{- partialCached $componentPartial . (string $reactComponent) -}}
{{- end -}}
{{- end -}}
{{- end -}}