Skip to content

Local search · English

    Build content loops and entry templates

    A loop repeats an authored item template for collection entries. A detail template supplies the layout for individual content pages. The repeated copies are rendered results; style the shared template and edit the selected entry through its native content controls.

    • Create several synthetic entries, including long and empty optional values. Plan a list page and any intended detail-page path before publication.
    1. Configure a loop container for the collection. In source, data-loop="articles" identifies the collection and its first eligible child element is the repeated item template. Bind fields inside that item to the current entry.

    2. Use supported loop filtering, ordering and limit/pagination settings. Filter at the loop rather than hiding individual repeated copies with a condition; hidden copies can make counts and empty-state expectations misleading.

    3. Add an intentional empty state using the supported empty-state surface or data-loop-empty marker. Test zero results, one entry and multiple pages. Only one loop per document may paginate, so decide which listing owns navigation.

    4. For entry detail pages, configure the native collection/template relationship and route pattern through the page workflow. Preview different entries, save and publish the layout and required content, then follow actual public list/detail links.

    • All repeated items share the intended design while displaying distinct entry values, and empty/paginated states remain usable.

    If the loop shows one fallback template or a diagnostic, check the collection slug and first child element. If an entry is missing, inspect filtering and publication before assuming data loss.

    Add visitor search, categories and pagination

    Section titled “Add visitor search, categories and pagination”
    1. Select the loop container in Builder and enable Visitor search and filters in its Inspector. Strukt saves strukt-visitor-listing.js in Site Code and records the controls as HTML attributes. Design remains script-inert; test the interaction in Preview and the published page.
    2. Optionally enter a simple Category element selector such as .category. Put that element and its category text inside each repeated card. A single class, tag or id selector is supported. Choose Results per page from 1 to 100; the default is 12.
    3. Save the page, review the saved site script, and publish the page with its required dependencies. Search, choose a category, navigate pages, use Reset, and check browser Back/Forward. Copy the URL to verify the same namespaced query state restores.

    Controls search the text of at most 500 already-rendered public cards on this page. The loop’s configured limit can make that set smaller. Existing server pagination pages are separate; this is not a database-wide search. Category choices are bounded to 100. Without JavaScript, all delivered cards remain visible. Static exports can run the saved listing script over those exported cards; they cannot retrieve additional CMS records. Local edits to the recognized script are preserved; inspect filename conflicts in Site Code before enabling controls.

    Applies to Strukt 0a5495fd6bf0f095b45937f0d6868b4f2a242e48 · 2026-11-16