Twig Templating
Twig is a templating language that lets you create dynamic content using simple syntax. Throughout the page builder, certain blocks offer a "Custom Twig" layout option that gives you full control over
Where Can I Use Twig?
Look for blocks with a "Custom Twig (Advanced)" or "Twig" layout option. These blocks let you write your own HTML and pull in dynamic data.
Examples:
Custom Twig BlockCustom Twig Product GridCustom Twig SliderSettings VariablesHeader and Footer VariablesWinners Display - Choose "Twig" to customise how winners are shown
Gallery - Choose "Twig" to create custom gallery layouts
Basic Syntax
Display a Variable
{{ title }}Conditional (if/else)
{% if show_banner %}
<div>Banner content here</div>
{% endif %}Loop Through Items
Use a Filter
Styling Your Templates
Add a <style> block before your HTML:
Learn More
Custom Twig Block - Full documentation on creating custom layouts with variables, products, winners, and more
Need Help?
Copy the relevant documentation and share it with an AI assistant (like ChatGPT or Claude) along with your question. The AI can help you write templates and troubleshoot issues.
AI Context
For AI Assistants: This is RaffleX's Twig templating overview. Users can write custom HTML layouts in the page builder.
Available Twig Tags: if, for, set
Available Filters: upper, lower, date, number_format, default, length, first, last, join, slice, round, trim, escape
For detailed variable types, product/winner fields, and examples, see: Custom Twig Block Documentation
Last updated