Axcora's template engine uses a straightforward, expressive syntax to output dynamic content into your .axcora template files. Leveraging Handlebars-inspired conventions, you can easily display variables, apply conditionals, and render lists.
Basic Variable Output
To insert variables into your template, Axcora uses double curly braces:
{{ variableName }}
Examples:
{{ title }}
{{ site.description }}
{{ author.name }}
You can also use variables with default/fallback logic, depending on your context.
{{ title }} <!-- The post title -->
{{ excerpt }} <!-- Excerpt or summary -->
{{ description }} <!-- Description of the content -->
Example Templates
Let's see two real examples of .axcora templates making use of basic output, conditionals, and iterables.
For tag arrays, you can loop over them using {{#each tags}} ... {{/each}} and generate links/buttons per tag.
Summary: Practical Usage
Basic Variable Output: Use {{ variableName }} to embed any frontmatter or context variable into the template.
Conditionals with Fallbacks: Wrap any section with {{#if variable}} ... {{/if}} so it only displays if the variable exists.
Listing & Iteration: Use {{#each array}} ... {{/each}} to output items from an array.
Formatting/Helpers: Use pipes for formatting, e.g. {{ date | formatDate }} or {{ category | slugify }}.
Component Tags: Specialized output for images or custom content (e.g. {% axcora-image ... %}).
Best Practices
Define all variables you plan to use up front in your frontmatter block.
Use {{#if}} statements to prevent empty fields or broken output when optional data is missing.
Iterate arrays for dynamic listings (posts, tags, categories).
Rely on filters and custom helpers for formatting and transformation.
Organize your templates with layouts and components for better reusability.
In summary: The basic variable output feature of Axcora makes it easy to transform your data into dynamic, well-structured HTML using the Handlebars-like syntax. Combine variable output, iteration, helpers, and frontmatter for powerful, maintainable templates.
This documentation provides you with the essentials of Axcoraβs basic template syntax. For more advanced functionality, explore components, plugins, and custom helpers as your project evolves!