📖
Genèse
  • Quick Start
  • Templates
    • Template
    • Injection
    • Conditional rendering
    • Frontmatter
  • Generators
    • Generator
    • Prompt
Powered by GitBook
On this page
  1. Templates

Conditional rendering

When the to: value is null, it skips the output of that template, meaning it won't get rendered at all.

I the following example, the template won't be rendered if name is undefined:

---
to: {{ name ? 'where/to/render/'~name~'.js' : null %>
---

In the following example, the template won't be rendered if the body contains a specific string:

---
to: ...
skip_if: /somebody/
---
<p>I always feel like, somebody's watching me.</p>
PreviousInjectionNextFrontmatter

Last updated 3 years ago