Morten Sæther

← Blog

Web Templates Introduction

#15 · 18 May 2026

Liquid, variables, loops, and building templates you can reuse

This is where Power Pages stops being a configuration exercise and starts being development. Web templates run on Liquid, and once you’re comfortable with it you can render just about anything from your Dataverse data.

If you’ve used Jekyll or Shopify themes you already know the syntax. If you haven’t, it’s about an hour to get productive - it’s a small language and it does one job.

Step by step

1. Get the syntax under your fingers

The basics:

<!-- Variables and Output -->
{{ page.title | escape }}
{{ user.fullname | escape }}
{{ entity.name | escape }}

<!-- Comments (not rendered) -->
{% comment %}
This is a comment that won't appear in the output
{% endcomment %}

<!-- Liquid Tags (logic and control) -->
{% if user %}
    Welcome back, {{ user.fullname | escape }}!
{% endif %}

<!-- Filters for data transformation -->
{{ product.price | round: 2 }}
{{ article.content | strip_html | truncate: 100 }}
{{ customer.emailaddress1 | downcase }}

user is the signed-in contact record, or null for anonymous visitors, so {% if user %} is the sign-in check. Everything that comes from Dataverse goes through escape before it hits the page.

Two kinds of template exist, and it’s worth knowing which one you’re editing:

  1. Page templates - what a web page renders with. Type Rewrite points at a built-in .aspx page; type Web Template points at a web template.
  2. Web templates - the Liquid source. They can be whole page layouts, headers and footers, or fragments you include elsewhere.

Basic forms, lists, multistep forms and content snippets are components you place inside those templates, not templates themselves.

2. Write your first template

{% extends 'Layout' %}

{% block title %}Dashboard - {{ user.fullname | escape }}{% endblock %}

{% block content %}
{% comment %}
Customer Portal Dashboard
Purpose: Main landing page for authenticated customers
{% endcomment %}

{% fetchxml open_cases %}
<fetch>
  <entity name="incident">
    <attribute name="incidentid"></attribute>
    <attribute name="title"></attribute>
    <attribute name="ticketnumber"></attribute>
    <attribute name="createdon"></attribute>
    <attribute name="prioritycode"></attribute>
    <attribute name="statecode"></attribute>
    <order attribute="createdon" descending="true"></order>
    <filter type="and">
      <condition attribute="customerid" operator="eq" value="{{ user.id }}"></condition>
      <condition attribute="statecode" operator="eq" value="0"></condition>
    </filter>
  </entity>
</fetch>
{% endfetchxml %}

{% fetchxml orders %}
<fetch>
  <entity name="salesorder">
    <attribute name="salesorderid"></attribute>
    <filter type="and">
      <condition attribute="customerid" operator="eq" value="{{ user.id }}"></condition>
    </filter>
  </entity>
</fetch>
{% endfetchxml %}

{% fetchxml open_invoices %}
<fetch>
  <entity name="invoice">
    <attribute name="invoiceid"></attribute>
    <filter type="and">
      <condition attribute="customerid" operator="eq" value="{{ user.id }}"></condition>
      <condition attribute="statecode" operator="eq" value="0"></condition>
    </filter>
  </entity>
</fetch>
{% endfetchxml %}

<div class="dashboard-container">
    <!-- Welcome Section -->
    <div class="dashboard-header">
        <div class="welcome-message">
            <h1>Welcome back, {{ user.fullname | escape }}!</h1>
        </div>
    </div>

    <!-- Dashboard Stats -->
    <div class="dashboard-stats">
        <div class="stat-card">
            <div class="stat-number">{{ open_cases.results.entities.size }}</div>
            <div class="stat-label">Open Support Cases</div>
            <div class="stat-action">
                <a href="/support/cases" class="btn btn-outline-primary btn-sm">View All</a>
            </div>
        </div>

        <div class="stat-card">
            <div class="stat-number">{{ orders.results.entities.size }}</div>
            <div class="stat-label">Total Orders</div>
            <div class="stat-action">
                <a href="/orders" class="btn btn-outline-primary btn-sm">View History</a>
            </div>
        </div>

        <div class="stat-card">
            <div class="stat-number">{{ open_invoices.results.entities.size }}</div>
            <div class="stat-label">Open Invoices</div>
            <div class="stat-action">
                <a href="/billing/invoices" class="btn btn-outline-primary btn-sm">Pay Now</a>
            </div>
        </div>
    </div>

    <!-- Recent Activity -->
    <div class="dashboard-section">
        <h2>Recent Activity</h2>

        {% if open_cases.results.entities.size > 0 %}
            <div class="activity-list">
                {% for case in open_cases.results.entities limit: 5 %}
                    <div class="activity-item">
                        <div class="activity-icon case-icon">🎫</div>
                        <div class="activity-content">
                            <div class="activity-title">
                                <a href="/support/case/?id={{ case.id }}">{{ case.title | escape }}</a>
                            </div>
                            <div class="activity-meta">
                                Case #{{ case.ticketnumber | escape }} •
                                Created {{ case.createdon | date: "MMM dd, yyyy" }} •
                                Priority: {{ case.prioritycode.label | escape }}
                            </div>
                        </div>
                        <div class="activity-status">
                            <span class="status-badge status-{{ case.statecode.value }}">
                                {{ case.statecode.label | escape }}
                            </span>
                        </div>
                    </div>
                {% endfor %}
            </div>
        {% else %}
            <div class="empty-state">
                <div class="empty-icon">✅</div>
                <h4>No open support cases</h4>
                <p>You're all caught up! If you need help, feel free to create a new support case.</p>
                <a href="/support/new-case" class="btn btn-primary">Create Support Case</a>
            </div>
        {% endif %}
    </div>

    <!-- Quick Actions -->
    <div class="dashboard-section">
        <h2>Quick Actions</h2>
        <div class="quick-actions-grid">
            <a href="/support/new-case" class="quick-action-card">
                <div class="action-icon">🎫</div>
                <div class="action-title">Create Support Case</div>
                <div class="action-description">Get help with technical issues</div>
            </a>

            <a href="/orders/new" class="quick-action-card">
                <div class="action-icon">🛒</div>
                <div class="action-title">Place New Order</div>
                <div class="action-description">Browse and order products</div>
            </a>

            <a href="/profile/edit" class="quick-action-card">
                <div class="action-icon">👤</div>
                <div class="action-title">Update Profile</div>
                <div class="action-description">Manage your account information</div>
            </a>

            <a href="/billing/payment-methods" class="quick-action-card">
                <div class="action-icon">💳</div>
                <div class="action-title">Payment Methods</div>
                <div class="action-description">Manage billing and payments</div>
            </a>
        </div>
    </div>
</div>
{% endblock %}

extends has to be the first thing in the template and can only be followed by block tags, so the queries and logic live inside the blocks. Layout is the name of another web template, shown in step 5. The counts are the size of what the query returned, which is fine for a dashboard; table permissions on incident, salesorder and invoice decide what the query returns at all.

3. Get at your data

The data types and how you reach them:

<!-- User Context Variables (the contact record, null when anonymous) -->
{{ user.id }}                    <!-- Contact ID -->
{{ user.fullname | escape }}     <!-- Full name -->
{{ user.emailaddress1 | escape }}<!-- Email address -->
{{ user.roles | join: ', ' }}    <!-- Web roles, as an array -->

<!-- Page Context Variables -->
{{ page.title | escape }}        <!-- Current page title -->
{{ page.id }}                    <!-- Current page ID -->
{{ page.url }}                   <!-- Current page URL -->
{{ page.parent.title | escape }} <!-- Parent page -->

<!-- Entity Data Access: one record by ID -->
{% assign contact = entities.contact[user.id] %}
{{ contact.fullname | escape }}
{{ contact.emailaddress1 | escape }}
{{ contact.address1_city | escape }}

<!-- Query Entities with Filters -->
{% fetchxml active_orders %}
<fetch>
  <entity name="salesorder">
    <attribute name="salesorderid"></attribute>
    <attribute name="name"></attribute>
    <attribute name="customerid"></attribute>
    <attribute name="totalamount"></attribute>
    <order attribute="createdon" descending="true"></order>
    <filter type="and">
      <condition attribute="customerid" operator="eq" value="{{ user.id }}"></condition>
      <condition attribute="statecode" operator="eq" value="0"></condition>
    </filter>
  </entity>
</fetch>
{% endfetchxml %}

<!-- Accessing Related Entity Data -->
{% for order in active_orders.results.entities %}
    <div class="order-item">
        <h4>Order {{ order.name | escape }}</h4>
        <p>Customer: {{ order.customerid.name | escape }}</p>
        <p>Total: {{ order.totalamount | round: 2 }}</p>
    </div>
{% endfor %}

entities loads one record by table name and ID; it isn’t a queryable collection. For anything that returns a list, use the fetchxml tag and read results.entities. A lookup field gives you id, logical_name and name of the related record, not the whole row - load that separately with entities if you need more. And skip the self-closing tags inside fetchxml; <attribute name="x"></attribute> is the form the tag parses.

4. Logic and loops

Conditionals, once things get real:

<!-- Multi-condition Logic -->
{% if user and user.roles contains 'Premium Customer' %}
    <div class="premium-dashboard">
        {% include 'Premium Features' %}
    </div>
{% elsif user %}
    <div class="standard-dashboard">
        {% include 'Standard Features' %}
    </div>
{% else %}
    <div class="public-content">
        <h2>Welcome to Our Customer Portal</h2>
        <p>Please <a href="{{ website.sign_in_url_substitution }}">sign in</a> to access your account.</p>
    </div>
{% endif %}

<!-- Switch-like Logic with Case -->
{% assign subscription_level = settings['Portal/SubscriptionLevel'] | default: 'basic' %}
{% case subscription_level %}
    {% when 'enterprise' %}
        {% assign support_priority = 'High' %}
        {% assign response_time = '2 hours' %}
    {% when 'professional' %}
        {% assign support_priority = 'Medium' %}
        {% assign response_time = '4 hours' %}
    {% when 'basic' %}
        {% assign support_priority = 'Standard' %}
        {% assign response_time = '24 hours' %}
    {% else %}
        {% assign support_priority = 'Low' %}
        {% assign response_time = '48 hours' %}
{% endcase %}

<div class="support-info">
    <p>Your support level: {{ support_priority }}</p>
    <p>Expected response time: {{ response_time }}</p>
</div>

Loops and data manipulation:

<!-- Orders by year: sorted query, new heading whenever the year changes -->
{% fetchxml orders %}
<fetch>
  <entity name="salesorder">
    <attribute name="salesorderid"></attribute>
    <attribute name="name"></attribute>
    <attribute name="createdon"></attribute>
    <attribute name="totalamount"></attribute>
    <attribute name="statecode"></attribute>
    <order attribute="createdon" descending="true"></order>
    <filter type="and">
      <condition attribute="customerid" operator="eq" value="{{ user.id }}"></condition>
    </filter>
  </entity>
</fetch>
{% endfetchxml %}

{% assign current_year = '' %}
<div class="orders-by-year">
    {% for order in orders.results.entities %}
        {% assign order_year = order.createdon | date: "yyyy" %}
        {% if order_year != current_year %}
            {% unless forloop.first %}</div></div>{% endunless %}
            {% assign current_year = order_year %}
            <div class="year-section">
                <h3>{{ order_year }} Orders</h3>
                <div class="orders-grid">
        {% endif %}
                    <div class="order-card">
                        <div class="order-header">
                            <span class="order-number">{{ order.name | escape }}</span>
                            <span class="order-date">{{ order.createdon | date: "MMM dd" }}</span>
                        </div>
                        <div class="order-amount">{{ order.totalamount | round: 2 }}</div>
                        <div class="order-status">
                            <span class="status-badge status-{{ order.statecode.value }}">
                                {{ order.statecode.label | escape }}
                            </span>
                        </div>
                    </div>
        {% if forloop.last %}</div></div>{% endif %}
    {% endfor %}
</div>

<!-- Grouping by an attribute value (contacts is a fetchxml result over contact) -->
{% assign by_city = contacts.results.entities | group_by: 'address1_city' %}
{% for group in by_city %}
    <h3>{{ group.key | escape }}</h3>
    <p>{{ group.items.size }} contacts</p>
{% endfor %}

<!-- Pagination Logic -->
{% assign page_size = 10 %}
{% assign current_page = request.params.page | integer | default: 1 %}
{% assign skip_count = current_page | minus: 1 | times: page_size %}

{% fetchxml articles %}
<fetch>
  <entity name="knowledgearticle">
    <attribute name="knowledgearticleid"></attribute>
    <attribute name="articlepublicnumber"></attribute>
    <attribute name="title"></attribute>
    <attribute name="description"></attribute>
    <attribute name="createdon"></attribute>
    <order attribute="createdon" descending="true"></order>
    <filter type="and">
      <condition attribute="statecode" operator="eq" value="3"></condition>
    </filter>
  </entity>
</fetch>
{% endfetchxml %}

{% assign all_articles = articles.results.entities %}
{% assign total_pages = all_articles.size | plus: page_size | minus: 1 | divided_by: page_size %}
{% assign page_articles = all_articles | skip: skip_count | take: page_size %}

<div class="articles-list">
    {% for article in page_articles %}
        <article class="article-card">
            <h3><a href="/kb/?number={{ article.articlepublicnumber | url_escape }}">{{ article.title | escape }}</a></h3>
            <p>{{ article.description | escape | truncate: 150 }}</p>
            <div class="article-meta">
                Published {{ article.createdon | date: "MMMM dd, yyyy" }}
            </div>
        </article>
    {% endfor %}
</div>

<!-- Pagination Controls -->
{% if total_pages > 1 %}
    {% assign previous_page = current_page | minus: 1 %}
    {% assign next_page = current_page | plus: 1 %}
    <nav class="pagination">
        {% if current_page > 1 %}
            <a href="{{ request.path | add_query: 'page', previous_page }}" class="page-link">← Previous</a>
        {% endif %}

        {% for page_number in (1..total_pages) %}
            {% if page_number == current_page %}
                <span class="page-link current">{{ page_number }}</span>
            {% else %}
                <a href="{{ request.path | add_query: 'page', page_number }}" class="page-link">{{ page_number }}</a>
            {% endif %}
        {% endfor %}

        {% if current_page < total_pages %}
            <a href="{{ request.path | add_query: 'page', next_page }}" class="page-link">Next →</a>
        {% endif %}
    </nav>
{% endif %}

Three details that bite. group_by groups on the exact attribute value and exposes group.key and group.items, so grouping on a date/time gives one group per record - hence the running-year loop instead. Array paging is skip and take. And divided_by on integers truncates, so the page count is (total + page_size - 1) / page_size, not ceil on an already-truncated result. The paging here still fetches every article and slices in Liquid; past a few hundred rows, move the paging into the query with count and page on the fetch element, or use a list.

5. Stop repeating yourself

A base layout everything else extends. This is a web template named Layout, used by a page template of type Web Template with “Use Website Header and Footer” unchecked, so it owns the whole document:

<!DOCTYPE html>
<html lang="{{ language.code | default: 'en-US' }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}{{ page.title | escape }}{% endblock %} - {{ website.adx_name | escape }}</title>

    <!-- Meta tags -->
    <meta name="description" content="{% block description %}{{ page.adx_summary | strip_html | escape }}{% endblock %}">

    <!-- Favicon and CSS are web files, served at their partial URL -->
    <link rel="icon" href="/favicon.ico">
    <link rel="stylesheet" href="/main.css">
    {% block stylesheets %}{% endblock %}
</head>
<body class="{% block body_class %}{% endblock %}">
    <!-- Skip to main content (accessibility) -->
    <a href="#main-content" class="skip-link">Skip to main content</a>

    <!-- Header -->
    <header class="site-header">
        {% include 'Header' %}
    </header>

    <!-- Main Navigation -->
    <nav class="main-navigation">
        {% include 'top_navigation' %}
    </nav>

    <!-- Breadcrumbs -->
    {% if page.breadcrumbs.size > 0 %}
        <nav class="breadcrumbs" aria-label="Breadcrumb">
            {% include 'breadcrumbs' %}
        </nav>
    {% endif %}

    <!-- Main Content -->
    <main id="main-content" class="main-content">
        {% block content %}
            <div class="container">
                <h1>{{ page.title | escape }}</h1>
                {% include 'page_copy' %}
            </div>
        {% endblock %}
    </main>

    <!-- Sidebar -->
    {% block sidebar %}{% endblock %}

    <!-- Footer -->
    <footer class="site-footer">
        {% include 'Footer' %}
    </footer>

    <!-- JavaScript -->
    <script src="/main.js"></script>
    {% block scripts %}{% endblock %}

    <!-- Live Chat Widget -->
    {% assign live_chat = settings['Portal/EnableLiveChat'] | boolean | default: false %}
    {% if user and live_chat %}
        {% include 'Live Chat Widget' %}
    {% endif %}
</body>
</html>

top_navigation, breadcrumbs and page_copy are built-in web templates; Header, Footer and Live Chat Widget are your own. Site settings come back as strings, so run them through boolean or integer before testing them.

And components you can drop in wherever. A web template named Status Badge, taking its inputs as include parameters:

{% comment %} Status Badge: parameters status_type, status_value, status_label {% endcomment %}
{% assign badge_class = 'status-badge-default' %}
{% if status_type == 'case' %}
    {% case status_value %}
        {% when 0 %}{% assign badge_class = 'status-badge-open' %}
        {% when 1 %}{% assign badge_class = 'status-badge-resolved' %}
        {% when 2 %}{% assign badge_class = 'status-badge-cancelled' %}
    {% endcase %}
{% endif %}

<span class="status-badge {{ badge_class }} status-{{ status_type }}-{{ status_value }}">
    {{ status_label | escape }}
</span>

<!-- Usage in other templates -->
{% include 'Status Badge' status_type: 'case', status_value: case.statecode.value, status_label: case.statecode.label %}

The parameter syntax is {% include 'Name' a: x, b: y %} - no comma after the template name. Included templates also see every variable the parent has defined, which is convenient and a source of surprising bugs.

I used to carry a generic data-table component around too; it’s left out here because building its column definitions as data in Liquid is more awkward than just writing the table.

6. Keep rendering fast

<!-- Page in the query, not in Liquid -->
{% assign page_size = 20 %}
{% assign current_page = request.params.page | integer | default: 1 %}

{% fetchxml products %}
<fetch count="{{ page_size }}" page="{{ current_page }}">
  <entity name="product">
    <attribute name="productid"></attribute>
    <attribute name="name"></attribute>
    <attribute name="productnumber"></attribute>
    <order attribute="name"></order>
    <filter type="and">
      <condition attribute="statecode" operator="eq" value="0"></condition>
    </filter>
  </entity>
</fetch>
{% endfetchxml %}

<!-- One query for the list, one lookup per detail you actually need -->
{% for product in products.results.entities %}
    <p>{{ product.productnumber | escape }} - {{ product.name | escape }}</p>
{% endfor %}

Every entities[...] lookup inside a loop is a query per iteration, and every related-record walk (order.customerid, then loading that contact) is another. Fetch the collection once with the attributes you need, and let count and page on the fetch element limit how much comes back. That’s the classic way to keep a fast portal fast.

What this looks like in practice

A support case template pulling most of the above together:

{% extends 'Layout' %}

{% block title %}Support Case {{ request.params.id | escape }}{% endblock %}

{% block content %}
{% assign case_id = request.params.id %}
{% assign support_case = entities.incident[case_id] %}

{% assign is_agent = user | has_role: 'Support Agent' %}

{% unless support_case %}
    <div class="empty-state">
        <h2>Case not found</h2>
        <a href="/support/cases" class="btn btn-outline-secondary">Back to All Cases</a>
    </div>
{% elsif is_agent == false and support_case.customerid.id != user.id %}
    <div class="empty-state">
        <h2>You don't have access to this case</h2>
        <a href="/support/cases" class="btn btn-outline-secondary">Back to All Cases</a>
    </div>
{% else %}

{% assign customer = entities.contact[support_case.customerid.id] %}

{% fetchxml case_activities %}
<fetch>
  <entity name="activitypointer">
    <attribute name="activityid"></attribute>
    <attribute name="subject"></attribute>
    <attribute name="description"></attribute>
    <attribute name="activitytypecode"></attribute>
    <attribute name="createdon"></attribute>
    <attribute name="createdby"></attribute>
    <order attribute="createdon" descending="true"></order>
    <filter type="and">
      <condition attribute="regardingobjectid" operator="eq" value="{{ support_case.id }}"></condition>
    </filter>
  </entity>
</fetch>
{% endfetchxml %}

<div class="support-case-detail">
    <!-- Case Header -->
    <div class="case-header">
        <div class="case-title-section">
            <h1>{{ support_case.title | escape }}</h1>
            <div class="case-meta">
                <span class="case-number">Case #{{ support_case.ticketnumber | escape }}</span>
                <span class="case-date">Created {{ support_case.createdon | date: "MMMM dd, yyyy 'at' h:mm tt" }}</span>
            </div>
        </div>

        <div class="case-status-section">
            {% include 'Status Badge' status_type: 'case', status_value: support_case.statecode.value, status_label: support_case.statecode.label %}
            {% include 'Status Badge' status_type: 'priority', status_value: support_case.prioritycode.value, status_label: support_case.prioritycode.label %}
        </div>
    </div>

    <!-- Case Details Grid -->
    <div class="case-details-grid">
        <div class="case-info-card">
            <h3>Case Information</h3>
            <dl class="case-details">
                <dt>Subject:</dt>
                <dd>{{ support_case.title | escape }}</dd>

                <dt>Description:</dt>
                <dd>{{ support_case.description | escape | newline_to_br }}</dd>

                <dt>Origin:</dt>
                <dd>{{ support_case.caseorigincode.label | escape }}</dd>

                <dt>Product:</dt>
                <dd>{{ support_case.productid.name | default: 'Not specified' | escape }}</dd>

                {% if support_case.cr5f3_estimatedresolutiondate %}
                    <dt>Estimated Resolution:</dt>
                    <dd>{{ support_case.cr5f3_estimatedresolutiondate | date: "MMMM dd, yyyy" }}</dd>
                {% endif %}
            </dl>
        </div>

        {% if customer %}
        <div class="case-contact-card">
            <h3>Contact Information</h3>
            <div class="contact-details">
                <p class="contact-name">{{ customer.fullname | escape }}</p>
                <p class="contact-email">{{ customer.emailaddress1 | escape }}</p>
                <p class="contact-phone">{{ customer.telephone1 | escape }}</p>
            </div>
        </div>
        {% endif %}
    </div>

    <!-- Case Timeline -->
    <div class="case-timeline-section">
        <h3>Case Timeline</h3>

        <div class="timeline">
            {% for activity in case_activities.results.entities %}
                <div class="timeline-item activity-{{ activity.activitytypecode }}">
                    <div class="timeline-marker">
                        {% case activity.activitytypecode %}
                            {% when 'email' %}📧
                            {% when 'phonecall' %}📞
                            {% when 'task' %}✅
                            {% when 'appointment' %}📅
                            {% else %}💬
                        {% endcase %}
                    </div>

                    <div class="timeline-content">
                        <div class="activity-header">
                            <h4>{{ activity.subject | escape }}</h4>
                            <span class="activity-date">
                                {{ activity.createdon | date: "MMM dd, yyyy 'at' h:mm tt" }}
                            </span>
                        </div>

                        {% if activity.description %}
                            <div class="activity-description">
                                {{ activity.description | escape | newline_to_br }}
                            </div>
                        {% endif %}

                        <div class="activity-meta">
                            By {{ activity.createdby.name | escape }}
                        </div>
                    </div>
                </div>
            {% endfor %}

            <!-- Case Creation Event -->
            <div class="timeline-item timeline-start">
                <div class="timeline-marker">🎫</div>
                <div class="timeline-content">
                    <div class="activity-header">
                        <h4>Case Created</h4>
                        <span class="activity-date">
                            {{ support_case.createdon | date: "MMM dd, yyyy 'at' h:mm tt" }}
                        </span>
                    </div>
                    <div class="activity-description">
                        Support case was created by {{ support_case.createdby.name | escape }}
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Action Buttons -->
    <div class="case-actions">
        {% if support_case.statecode.value == 0 %}
            <a href="/support/case/comment/?id={{ support_case.id }}" class="btn btn-primary">Add Comment</a>

            {% if user.id == support_case.customerid.id %}
                <a href="/support/case/escalate/?id={{ support_case.id }}" class="btn btn-outline-secondary">Request Escalation</a>
            {% endif %}
        {% endif %}

        <a href="/support/cases" class="btn btn-outline-secondary">Back to All Cases</a>

        <button type="button" class="btn btn-outline-info" onclick="window.print()">Print Case</button>
    </div>
</div>

{% endunless %}
{% endblock %}

There is no redirect tag in Power Pages Liquid, so a missing or forbidden case renders a message instead. The real guard is the table permission on incident: if the visitor isn’t allowed to read the record, entities.incident[case_id] comes back null before any of this runs. Comment and escalation are pages with basic forms, which is where writes belong.

How to make a mess and fix it

  1. Template won’t compile - a Liquid tag somewhere isn’t closed
  2. Data missing - check entity relationships, then permissions
  3. Slow rendering - fetch collections once, and stop querying inside loops
  4. Variable is empty when it shouldn’t be - Liquid’s scoping rules, most likely
  5. Escaping - always escape user input, no exceptions

Wrapping up

Liquid is what makes Power Pages flexible. Start simple, build up a library of components you trust, and leave comments explaining anything clever - template logic is hard to read six months later.

Next: content snippets and localisation, for portals that need to speak more than one language.