mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
35 lines
1.1 KiB
Go Template
35 lines
1.1 KiB
Go Template
|
{{- $style := lower .style }}
|
||
|
{{- $set := "" }}
|
||
|
{{- range site.Params.boxStyle }}
|
||
|
{{- if eq (lower .identifier) $style }}
|
||
|
{{- $title := or .title (.i18n | T) }}
|
||
|
{{- $set = dict "style" $style "title" $title "icon" .icon }}
|
||
|
{{- break }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- if not $set }}
|
||
|
{{- range (slice
|
||
|
(dict "identifier" "caution" "icon" "hand")
|
||
|
(dict "identifier" "important" "icon" "bolt")
|
||
|
(dict "identifier" "info" "icon" "info-circle")
|
||
|
(dict "identifier" "note" "icon" "exclamation-circle")
|
||
|
(dict "identifier" "tip" "icon" "lightbulb")
|
||
|
(dict "identifier" "warning" "icon" "exclamation-triangle")
|
||
|
) }}
|
||
|
{{- if eq .identifier $style }}
|
||
|
{{- $title := .identifier | T }}
|
||
|
{{- $set = dict "style" $style "title" $title "icon" .icon }}
|
||
|
{{- break }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|
||
|
{{- if not $set }}
|
||
|
{{- $set = dict "style" $style "title" "" "icon" "" }}
|
||
|
{{- end }}
|
||
|
{{- if .title }}
|
||
|
{{- $set = merge $set (dict "title" .title) }}
|
||
|
{{- end }}
|
||
|
{{- if .icon }}
|
||
|
{{- $set = merge $set (dict "icon" .icon) }}
|
||
|
{{- end }}
|
||
|
{{- return $set }}
|