diff --git a/layouts/_default/_markup/render-blockquote.html b/layouts/_default/_markup/render-blockquote.html new file mode 100644 index 000000000..26876ab5d --- /dev/null +++ b/layouts/_default/_markup/render-blockquote.html @@ -0,0 +1,33 @@ +{{- if eq .Type "alert" }} + {{- $alerts := dict + "caution" (dict "color" "red" "icon" "exclamation-triangle") + "important" (dict "color" "blue" "icon" "exclamation-circle") + "note" (dict "color" "blue" "icon" "information-circle") + "tip" (dict "color" "green" "icon" "light-bulb") + "warning" (dict "color" "yellow" "icon" "exclamation-triangle") + }} + + {{- $alertTypes := slice }} + {{- range $k, $_ := $alerts }} + {{- $alertTypes = $alertTypes | append $k }} + {{- end }} + {{- $alertTypes = $alertTypes | sort }} + + {{- $alertType := strings.ToLower .AlertType }} + {{- if in $alertTypes $alertType }} + {{- partial "layouts/blocks/alert.html" (dict + "color" (or ((index $alerts $alertType).color) "blue") + "icon" (or ((index $alerts $alertType).icon) "information-circle") + "text" .Text + "title" .AlertTitle + "class" .Attributes.class + ) + }} + {{- else }} + {{- errorf `Invalid blockquote alert type. Received %s. Expected one of %s (case-insensitive). See %s.` .AlertType (delimit $alertTypes ", " ", or ") .Page.String }} + {{- end }} +{{- else }} +
+ {{ .Text }} ++{{- end }} diff --git a/layouts/partials/layouts/blocks/alert.html b/layouts/partials/layouts/blocks/alert.html index a16cca28a..45f0044d9 100644 --- a/layouts/partials/layouts/blocks/alert.html +++ b/layouts/partials/layouts/blocks/alert.html @@ -1,6 +1,6 @@ {{- $title := .title | default "" }} {{- $color := .color | default "yellow" }} -{{- $icon := .icon | default "exclamation" }} +{{- $icon := .icon | default "exclamation-triangle" }} {{- $text := .text | default "" }} {{- $class := .class | default "mt-6 mb-8" }}