← Back to Tips & Tricks Power Pages

Liquid Templates in Power Pages

Master Liquid templating to create dynamic, data-driven content in your Power Pages sites.

What is Liquid?

Liquid is a templating language that lets you add dynamic content to Power Pages. It's processed on the server, so visitors see only the rendered HTML.

Basic Syntax

Output Variables

{{ user.fullname }}
{{ page.title }}
{{ now | date: "MMMM dd, yyyy" }}

Logic Tags

{% if user %}
    Welcome, {{ user.firstname }}!
{% else %}
    Please sign in.
{% endif %}

Fetching Dataverse Data

{% fetchxml products %}
<fetch>
  <entity name="product">
    <attribute name="name" />
    <attribute name="price" />
    <filter>
      <condition attribute="statecode" operator="eq" value="0" />
    </filter>
    <order attribute="name" />
  </entity>
</fetch>
{% endfetchxml %}

<ul>
{% for product in products.results.entities %}
    <li>{{ product.name }} - {{ product.price | money }}</li>
{% endfor %}
</ul>

Useful Filters

FilterExampleOutput
date{{ now | date: "MMM d" }}Dec 27
money{{ 1234.5 | money }}$1,234.50
truncate{{ text | truncate: 50 }}First 50 chars...
escape{{ html | escape }}Encoded HTML

Web Templates

Create reusable components with web templates:

{% include 'Header' %}
{% include 'Product Card' product: item %}
{% include 'Footer' %}

Security Considerations

  • Always use Entity Permissions to secure data access
  • Escape user input to prevent XSS: {{ input | escape }}
  • Never expose sensitive fields in Liquid output

Debug tip: Add ?liquid=debug to the URL to see Liquid processing details (admin only).