Created
June 30, 2025 00:03
-
-
Save scivision/b35c657140c15766b01e07c0b752a59a to your computer and use it in GitHub Desktop.
Hugo alert boxes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* place under assets/css/blockquote.css */ | |
/* General alert styling */ | |
.alert { | |
padding: 1rem; | |
margin-bottom: 1rem; | |
border: 1px solid transparent; | |
border-radius: .25rem; | |
} | |
.alert-title { | |
display: block; | |
margin-bottom: 0.5rem; | |
font-weight: bold; | |
} | |
/* Note style */ | |
.alert-note { | |
color: #1c4b78; | |
background-color: #d1ecf1; | |
border-color: #bee5eb; | |
} | |
.alert-note .alert-title { | |
color: #0c5460; | |
} | |
/* Warning style */ | |
.alert-warning { | |
color: #856404; | |
background-color: #fff3cd; | |
border-color: #ffeeba; | |
} | |
.alert-warning .alert-title { | |
color: #856404; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add to hugo.yaml | |
markup: | |
goldmark: | |
parser: | |
attribute: | |
block: true | |
title: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- place at layouts/_default/_markup/render-blockquote.html --> | |
{{ resources.Get "css/blockquote.css" | .Page.Store.SetInMap "css" "blockquote" }} | |
{{ $emojis := dict | |
"caution" ":exclamation:" | |
"important" ":information_source:" | |
"note" ":information_source:" | |
"tip" ":bulb:" | |
"warning" ":information_source:" | |
}} | |
{{ if eq .Type "alert" }} | |
<blockquote class="alert alert-{{ .AlertType }}"> | |
<p class="alert-heading"> | |
{{ transform.Emojify (index $emojis .AlertType) }} | |
{{ with .AlertTitle }} | |
{{ . }} | |
{{ else }} | |
{{ or (i18n .AlertType) (title .AlertType) }} | |
{{ end }} | |
</p> | |
{{ .Text }} | |
</blockquote> | |
{{ else }} | |
<blockquote> | |
{{ .Text }} | |
</blockquote> | |
{{ end }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment