Queries are not cached and will cause slower page loads. There is a limit of eight queries per page.

Querying Items

To initiate a Squarespace Query add the query tag to your collection with one more parameters. All parameters are optional except for collection. All code inside of the opening and closing query tags will inherit the scope set by the parameters.

<squarespace:query collection="new-blog" limit="10">

<ol>
{.repeated section items}
<li><a href="{fullUrl}">{title}</a></li>
{.end}
</ol>

</squarespace:query>

Parameters

collection* The URL of the collection you want to get the items from.
limit The number of posts you'd like returned.
tag** Only return items that have this tag.
category** Only return items that have this category.
featured Filters the return to only contain posts that have been flagged as "Featured." Accepts true or false (default).
* Required
** Multiple values accepted, comma-separated.

Example

Featured Items

This example demonstrates how to create a featured item module that is flexible enough to be used on any .list file. To achieve that flexibility we'll pull in the collection URL dynamically.

blog.list
----------------------------
<squarespace:query collection="{.section collection}{urlId}{.end}" featured="true" limit="5">

<div class="featured-wrapper">
{.repeated section items}
<div class="featured-post">
{.main-image?}<img {@|image-meta} />{.end}
<h2>{title}</h2>
</div>
{.end}
</div>

</squarespace:query>