Skip to content

Commit

Permalink
Update Shortcodes doc to add details on Macros for templates (getzola…
Browse files Browse the repository at this point in the history
  • Loading branch information
magikstm authored and Newbytee committed Feb 16, 2023
1 parent 3f76424 commit 85b4b7e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/content/documentation/content/shortcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ weight = 40

Zola borrows the concept of [shortcodes](https://codex.wordpress.org/Shortcode_API) from WordPress.
In our case, a shortcode corresponds to a template defined in the `templates/shortcodes` directory or
a built-in one that can be used in a Markdown file. If you want to use something similar to shortcodes in your templates,
try [Tera macros](https://tera.netlify.com/docs#macros).
a built-in one that can be used in a Markdown file.

Broadly speaking, Zola's shortcodes cover two distinct use cases:

Expand All @@ -18,6 +17,8 @@ The latter may also be solved by writing HTML, however Zola allows the use of Ma
rather than `.html`. This may be particularly useful if you want to include headings generated by the shortcode in the
[table of contents](@/documentation/content/table-of-contents.md).

If you want to use something similar to shortcodes in your templates, you can use [Tera macros](https://tera.netlify.com/docs#macros). They are functions or components that you can call to return some text.

## Writing a shortcode
Let's write a shortcode to embed YouTube videos as an example.
In a file called `youtube.html` in the `templates/shortcodes` directory, paste the
Expand Down

0 comments on commit 85b4b7e

Please sign in to comment.