Skip to content
Franco Mussopower pages
Code snippet

Boilerplate for Carousel with Liquid and Fetch XML

Copy it with the button on the code. For the why and the walkthrough, see “Creating a Bootstrap Carousel (Slider) using Liquid and Fetch XML”.

Boilerplate for Carousel with Liquid and Fetch XMLLiquid
{% fetchxml name_of_query %}
    Paste your Fetch XML here    
{% endfetchxml %}
 
{% if name_of_query.results.entities.size > 0 %}
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
        <!-- Indicators -->
        <ol class="carousel-indicators">
            {% for result in name_of_query.results.entities %}
                <li data-target="#carousel-example-generic" data-slide-to="{{ forloop.index | minus: 1 }}" {% if forloop.first %}class="active"{% endif %}></li>
            {% endfor %}
        </ol>
 
        <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
            {% for result in name_of_query.results.entities %}
                <div class="item {% if forloop.first %}active{% endif %}">
                <img src="{{ result.logicalNameforImagecolumn_url }}&Full=true" alt="...">
                <div class="carousel-caption">
                    <h3>{{ result.logicalNameForNameColumn }}</h3>
                    <p>{{ result.logicalNameForDescriptionColumn }}</p>
                    <a class="btn btn-primary" href="/Partial-URL/?id={{ result.guidForThisRecord }}">View Details</a>
                </div>
                </div>
            {% endfor %}
        </div>
 
        <!-- Controls -->
        <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
        </a>
        <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div>
{% endif %}

Search

Book a discovery call

30 minutes. Bring your trickiest Power Pages problem — I’ll tell you honestly whether I’m the right fit.