You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> You can highlight important information in your articles or docs using different types of callouts (also known as admonitions – or alerts, as used in [the Hugo docs](https://gohugo.io/render-hooks/blockquotes/#alerts)).
124
124
125
-
The examples below use the same syntax as in Github Markdown. The template responsible for rendering them is at `site/layouts/_default/_markup/render-blockquote.html`
125
+
For compatibility with HTML and Markdown in both content and layout files, we use a mix of shortcodes and partials to display blockquote alerts. Shortcodes on their own don't work in layout files, so you'll want to call a partial in layout files but use a shortcode (that calls the partial) in Markdown and HTML content files.
126
+
127
+
The partial is at `site/layouts/partials/blockquote-alert.html`, and the shortcode is at `site/layouts/shortcodes/blockquote-alert.html`.
128
+
129
+
There are five alert types. You can use these directly in Markdown and HTML cotent files. Omit the `title` parameter to keep the alert type as the default title (for example, a note alert will have "Note" as its title):
126
130
127
131
```
128
-
> [!NOTE]
129
-
> Useful information that users should know, even when skimming content.
"content" "<p>Want to stay updated? <a href='/subscribe'>Join our newsletter</a>.</p>"
213
+
) }}
214
+
{{ end }}
215
+
```
216
+
217
+
**NOTE:**
218
+
219
+
You'll want to handle line breaks properly within the HTML content string when working with complex content. For example, the following will throw a parse error (`html: overlay: parse failed unterminated quoted string in action`):
220
+
221
+
```
222
+
{{ partial "blockquote-alert" (dict
223
+
"type" "caution"
224
+
"title" "Be Careful!"
225
+
"content" "<p>This is a <strong>caution</strong> message.</p>
226
+
<p>It has multiple paragraphs.</p>"
227
+
) }}
228
+
```
229
+
230
+
To fix this, you can:
231
+
232
+
- Keep everything on a single line
233
+
- Use string concatenation (whether in a variable or directly)
234
+
235
+
```
236
+
{{ partial "blockquote-alert" (dict
237
+
"type" "caution"
238
+
"title" "Be Careful!"
239
+
"content" "<p>This is a <strong>caution</strong> message.</p><p>It has multiple paragraphs.</p>"
240
+
) }}
241
+
242
+
---------------
243
+
244
+
{{ $alertContent := add
245
+
"<p>This is a <strong>caution</strong> message.</p>"
0 commit comments