add how to escape shortcodes
Some checks failed
deploy-docs / build-and-deploy (push) Failing after 13s
Some checks failed
deploy-docs / build-and-deploy (push) Failing after 13s
This commit is contained in:
@@ -36,6 +36,21 @@ Custom shortcodes defined in `layouts/shortcodes/`.
|
||||
* **`rawhtml`**: Insert raw HTML content.
|
||||
* Usage: `{{/* rawhtml*/}}<div>Your HTML here</div>{{/* /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):** `{{</* shortcode_name */>}}`
|
||||
* **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/).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user