Want a simple way to show only 2025 (or any year) items from a Webflow CMS list?This tiny helper uses data attributes—no jQuery, no libraries—to filter your CMS cards by year, highlight the active button, and show a friendly “No items found” message when there’s nothing to display.
This lightweight animation:
2025 / 2024 / 2023
?year=2025
or #year=2025
1. Add the script
Wrap each filterable block (buttons + list + empty text) in a parent with data-year-scope
.
data-filter-year="2025"
(and so on).data-year="YYYY"
.data-empty
<div data-year-scope>
<div class="year-buttons">
<!-- CMS Collection Item wrapper -->
<button data-filter-year="2025">2025</button>
<button data-filter-year="2024">2024</button>
<button data-filter-year="2023">2023</button>
<button data-filter-year="all">All</button>
</div>
<div class="cards">
<!-- CMS Collection Item wrapper -->
<article class="card" data-year="2025">…</article>
<article class="card" data-year="2024">…</article>
<!-- etc. -->
</div>
<p data-empty>No items found.</p>
</div>
data-year
on the Collection Item wrapper (the element that repeats), not on a child text node.</body>
in Page Settings or Site-wide Custom Code.