From 9eeda759ace8b8529a58aa0101ed68e65ad181c2 Mon Sep 17 00:00:00 2001 From: wompmacho Date: Sun, 12 Apr 2026 08:56:09 +0000 Subject: [PATCH] add how to escape shortcodes --- projects/hugo/hugo_shortcodes.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/hugo/hugo_shortcodes.md b/projects/hugo/hugo_shortcodes.md index 8a72ac5..e89c00d 100644 --- a/projects/hugo/hugo_shortcodes.md +++ b/projects/hugo/hugo_shortcodes.md @@ -36,6 +36,21 @@ Custom shortcodes defined in `layouts/shortcodes/`. * **`rawhtml`**: Insert raw HTML content. * Usage: `{{/* rawhtml*/}}
Your HTML here
{{/* /rawhtml*/}}` +### Escaping Shortcodes (For Documentation) + +When writing documentation *about* shortcodes (or anytime you need to display `{{< >}}` or `{{% %}}` without Hugo executing them), you **MUST** use Hugo's built-in comment syntax inside the delimiters. + +**The Rule:** Place `/*` immediately after the opening delimiter, and `*/` immediately before the closing delimiter. **No spaces are allowed between the delimiter and the comment marker.** + +* **Correct (Angle Brackets):** `{{}}` +* **Correct (Percentage Signs):** `{{%/* shortcode_name */%}}` +* **Correct (Inner only):** `{{/* shortcode_name */}}` (If you just want to show the generic brackets without `< >` or `% %`) + +**Common Mistakes that break the build:** +* ❌ `{{< /* shortcode */ >}}` (Spaces around the comment markers cause parsing errors or unrecognized characters) +* ❌ `{{/*< shortcode >*/}}` (Comment markers placed outside the inner delimiters) +* ❌ `{{` (Using HTML entities is unnecessary, harder to read in source, and can break copy-pasting) + ### Theme Shortcodes (Blowfish) Commonly used shortcodes from the [Blowfish theme](https://blowfish.page/docs/shortcodes/).